@tech_carthagos/page-builder 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CraftEditor-Grwj7M3H.js +2006 -0
- package/dist/CraftEditor-xRtkY2_B.cjs +72 -0
- package/dist/{index-DWRynqVc.js → index-BU18TokA.js} +909 -917
- package/dist/{index-GH-PwMSN.cjs → index-CyIoH_7r.cjs} +32 -32
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +5 -5
- package/dist-types/editor/Toolbox.d.ts.map +1 -1
- package/dist-types/examples/App.d.ts.map +1 -1
- package/dist-types/user/Div.d.ts +2 -4
- package/dist-types/user/Div.d.ts.map +1 -1
- package/dist-types/user/Footer.d.ts +1 -1
- package/dist-types/user/Footer.d.ts.map +1 -1
- package/dist-types/user/Section.d.ts +2 -2
- package/dist-types/user/Section.d.ts.map +1 -1
- package/dist-types/user/Wrapper.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/CraftEditor-B8VkDZHb.js +0 -2256
- package/dist/CraftEditor-DHRDnczs.cjs +0 -72
|
@@ -0,0 +1,2006 @@
|
|
|
1
|
+
import { jsx as l, jsxs as B, Fragment as Et } from "react/jsx-runtime";
|
|
2
|
+
import * as p from "react";
|
|
3
|
+
import m, { useState as Ne, forwardRef as Vo, isValidElement as Ue, useEffect as jo } from "react";
|
|
4
|
+
import { c as Y, N as Je, a as Nt, C as Tt, P as xe, B as De, L as Rt, F as Go, k as ie, b as Ae, d as Pt, S as kt, W as et, H as It, T as Dt, e as At, f as Mt, I as _t, V as Lt, D as zt, g as $t, u as re, h as ze, i as te, j as $e, l as W, m as ce, n as Wo, o as Te, p as Yo, q as Uo, r as Xo, s as Ko, t as Oe, v as qo, w as Qo, M as Zo, x as Jo, y as er, z as tr, A as or, E as rr, G as nr, J as ar, K as sr, O as lr, Q as ir, R as cr, U as dr, X as Xe, Y as Ke } from "./index-BU18TokA.js";
|
|
5
|
+
import ur from "react-dom";
|
|
6
|
+
/**
|
|
7
|
+
* @license lucide-react v0.462.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
const Ot = Y("Columns2", [
|
|
13
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
14
|
+
["path", { d: "M12 3v18", key: "108xh3" }]
|
|
15
|
+
]);
|
|
16
|
+
/**
|
|
17
|
+
* @license lucide-react v0.462.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/
|
|
22
|
+
const fr = Y("GripVertical", [
|
|
23
|
+
["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
|
|
24
|
+
["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
|
|
25
|
+
["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
|
|
26
|
+
["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
|
|
27
|
+
["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
|
|
28
|
+
["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
|
|
29
|
+
]);
|
|
30
|
+
/**
|
|
31
|
+
* @license lucide-react v0.462.0 - ISC
|
|
32
|
+
*
|
|
33
|
+
* This source code is licensed under the ISC license.
|
|
34
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
35
|
+
*/
|
|
36
|
+
const Bt = Y("Heading", [
|
|
37
|
+
["path", { d: "M6 12h12", key: "8npq4p" }],
|
|
38
|
+
["path", { d: "M6 20V4", key: "1w1bmo" }],
|
|
39
|
+
["path", { d: "M18 20V4", key: "o2hl4u" }]
|
|
40
|
+
]);
|
|
41
|
+
/**
|
|
42
|
+
* @license lucide-react v0.462.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/
|
|
47
|
+
const Ft = Y("Image", [
|
|
48
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
|
|
49
|
+
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
|
|
50
|
+
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
|
|
51
|
+
]);
|
|
52
|
+
/**
|
|
53
|
+
* @license lucide-react v0.462.0 - ISC
|
|
54
|
+
*
|
|
55
|
+
* This source code is licensed under the ISC license.
|
|
56
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
+
*/
|
|
58
|
+
const Ht = Y("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
|
|
59
|
+
/**
|
|
60
|
+
* @license lucide-react v0.462.0 - ISC
|
|
61
|
+
*
|
|
62
|
+
* This source code is licensed under the ISC license.
|
|
63
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
64
|
+
*/
|
|
65
|
+
const Vt = Y("MousePointer", [
|
|
66
|
+
["path", { d: "M12.586 12.586 19 19", key: "ea5xo7" }],
|
|
67
|
+
[
|
|
68
|
+
"path",
|
|
69
|
+
{
|
|
70
|
+
d: "M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",
|
|
71
|
+
key: "277e5u"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
]);
|
|
75
|
+
/**
|
|
76
|
+
* @license lucide-react v0.462.0 - ISC
|
|
77
|
+
*
|
|
78
|
+
* This source code is licensed under the ISC license.
|
|
79
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
+
*/
|
|
81
|
+
const jt = Y("MoveVertical", [
|
|
82
|
+
["path", { d: "M12 2v20", key: "t6zp3m" }],
|
|
83
|
+
["path", { d: "m8 18 4 4 4-4", key: "bh5tu3" }],
|
|
84
|
+
["path", { d: "m8 6 4-4 4 4", key: "ybng9g" }]
|
|
85
|
+
]);
|
|
86
|
+
/**
|
|
87
|
+
* @license lucide-react v0.462.0 - ISC
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the ISC license.
|
|
90
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/
|
|
92
|
+
const mr = Y("Redo2", [
|
|
93
|
+
["path", { d: "m15 14 5-5-5-5", key: "12vg1m" }],
|
|
94
|
+
["path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13", key: "6uklza" }]
|
|
95
|
+
]);
|
|
96
|
+
/**
|
|
97
|
+
* @license lucide-react v0.462.0 - ISC
|
|
98
|
+
*
|
|
99
|
+
* This source code is licensed under the ISC license.
|
|
100
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
+
*/
|
|
102
|
+
const pr = Y("Save", [
|
|
103
|
+
[
|
|
104
|
+
"path",
|
|
105
|
+
{
|
|
106
|
+
d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
|
|
107
|
+
key: "1c8476"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
|
|
111
|
+
["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
|
|
112
|
+
]);
|
|
113
|
+
/**
|
|
114
|
+
* @license lucide-react v0.462.0 - ISC
|
|
115
|
+
*
|
|
116
|
+
* This source code is licensed under the ISC license.
|
|
117
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
118
|
+
*/
|
|
119
|
+
const ye = Y("Square", [
|
|
120
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
|
|
121
|
+
]);
|
|
122
|
+
/**
|
|
123
|
+
* @license lucide-react v0.462.0 - ISC
|
|
124
|
+
*
|
|
125
|
+
* This source code is licensed under the ISC license.
|
|
126
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
+
*/
|
|
128
|
+
const hr = Y("Trash2", [
|
|
129
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
130
|
+
["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
|
|
131
|
+
["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
|
|
132
|
+
["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
|
|
133
|
+
["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
|
|
134
|
+
]);
|
|
135
|
+
/**
|
|
136
|
+
* @license lucide-react v0.462.0 - ISC
|
|
137
|
+
*
|
|
138
|
+
* This source code is licensed under the ISC license.
|
|
139
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
+
*/
|
|
141
|
+
const Gt = Y("Type", [
|
|
142
|
+
["polyline", { points: "4 7 4 4 20 4 20 7", key: "1nosan" }],
|
|
143
|
+
["line", { x1: "9", x2: "15", y1: "20", y2: "20", key: "swin9y" }],
|
|
144
|
+
["line", { x1: "12", x2: "12", y1: "4", y2: "20", key: "1tx1rr" }]
|
|
145
|
+
]);
|
|
146
|
+
/**
|
|
147
|
+
* @license lucide-react v0.462.0 - ISC
|
|
148
|
+
*
|
|
149
|
+
* This source code is licensed under the ISC license.
|
|
150
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
+
*/
|
|
152
|
+
const gr = Y("Undo2", [
|
|
153
|
+
["path", { d: "M9 14 4 9l5-5", key: "102s5s" }],
|
|
154
|
+
["path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11", key: "f3b9sd" }]
|
|
155
|
+
]);
|
|
156
|
+
/**
|
|
157
|
+
* @license lucide-react v0.462.0 - ISC
|
|
158
|
+
*
|
|
159
|
+
* This source code is licensed under the ISC license.
|
|
160
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
+
*/
|
|
162
|
+
const vr = Y("Video", [
|
|
163
|
+
[
|
|
164
|
+
"path",
|
|
165
|
+
{
|
|
166
|
+
d: "m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",
|
|
167
|
+
key: "ftymec"
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
["rect", { x: "2", y: "6", width: "14", height: "12", rx: "2", key: "158x01" }]
|
|
171
|
+
]), tt = ({
|
|
172
|
+
className: e,
|
|
173
|
+
backgroundColor: t = "transparent",
|
|
174
|
+
backgroundImage: o = "",
|
|
175
|
+
backgroundSize: r = "cover",
|
|
176
|
+
backgroundRepeat: n = "no-repeat",
|
|
177
|
+
padding: s = { top: 16, right: 16, bottom: 16, left: 16 },
|
|
178
|
+
margin: i = { top: 0, right: 0, bottom: 0, left: 0 },
|
|
179
|
+
width: c = "auto",
|
|
180
|
+
minHeight: d = 100,
|
|
181
|
+
maxWidth: u = "none",
|
|
182
|
+
display: f = "block",
|
|
183
|
+
flexDirection: h = "column",
|
|
184
|
+
justifyContent: g = "flex-start",
|
|
185
|
+
alignItems: a = "stretch",
|
|
186
|
+
gap: N = 0,
|
|
187
|
+
borderRadius: v = 8,
|
|
188
|
+
borderWidth: b = 1,
|
|
189
|
+
borderColor: C = "transparent",
|
|
190
|
+
borderStyle: S = "dashed",
|
|
191
|
+
boxShadow: w = "none",
|
|
192
|
+
children: T
|
|
193
|
+
}) => {
|
|
194
|
+
const {
|
|
195
|
+
connectors: { connect: z, drag: R },
|
|
196
|
+
selected: k
|
|
197
|
+
} = Je((M) => ({
|
|
198
|
+
selected: M.events.selected
|
|
199
|
+
})), D = typeof s == "object" ? `${s.top}px ${s.right}px ${s.bottom}px ${s.left}px` : `${s}px`, P = typeof i == "object" ? `${i.top}px ${i.right}px ${i.bottom}px ${i.left}px` : `${i}px`;
|
|
200
|
+
return /* @__PURE__ */ l(
|
|
201
|
+
"div",
|
|
202
|
+
{
|
|
203
|
+
style: {
|
|
204
|
+
backgroundColor: t,
|
|
205
|
+
backgroundImage: o ? `url(${o})` : "none",
|
|
206
|
+
backgroundSize: r,
|
|
207
|
+
backgroundRepeat: n,
|
|
208
|
+
padding: D,
|
|
209
|
+
margin: P,
|
|
210
|
+
width: c === "auto" ? "100%" : c,
|
|
211
|
+
minHeight: `${d}px`,
|
|
212
|
+
maxWidth: u === "none" ? "none" : `${u}px`,
|
|
213
|
+
display: f,
|
|
214
|
+
flexDirection: f === "flex" ? h : void 0,
|
|
215
|
+
justifyContent: f === "flex" ? g : void 0,
|
|
216
|
+
alignItems: f === "flex" ? a : void 0,
|
|
217
|
+
gap: f === "flex" ? `${N}px` : void 0,
|
|
218
|
+
borderRadius: `${v}px`,
|
|
219
|
+
borderWidth: `${b}px`,
|
|
220
|
+
borderColor: C,
|
|
221
|
+
borderStyle: S,
|
|
222
|
+
boxShadow: w === "none" ? "none" : w
|
|
223
|
+
},
|
|
224
|
+
className: Nt(
|
|
225
|
+
e,
|
|
226
|
+
`${k ? "ring-2 ring-primary ring-offset-2" : ""}`
|
|
227
|
+
),
|
|
228
|
+
ref: (M) => {
|
|
229
|
+
M && z(R(M));
|
|
230
|
+
},
|
|
231
|
+
children: T
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
};
|
|
235
|
+
tt.craft = {
|
|
236
|
+
isCanvas: !0,
|
|
237
|
+
props: {
|
|
238
|
+
ClassName: "p-4",
|
|
239
|
+
backgroundColor: "transparent",
|
|
240
|
+
backgroundImage: "",
|
|
241
|
+
backgroundSize: "cover",
|
|
242
|
+
backgroundRepeat: "no-repeat",
|
|
243
|
+
padding: { top: 16, right: 16, bottom: 16, left: 16 },
|
|
244
|
+
margin: { top: 0, right: 0, bottom: 0, left: 0 },
|
|
245
|
+
width: "auto",
|
|
246
|
+
minHeight: 100,
|
|
247
|
+
maxWidth: "none",
|
|
248
|
+
display: "block",
|
|
249
|
+
flexDirection: "column",
|
|
250
|
+
justifyContent: "flex-start",
|
|
251
|
+
alignItems: "stretch",
|
|
252
|
+
gap: 0,
|
|
253
|
+
borderRadius: 8,
|
|
254
|
+
borderWidth: 1,
|
|
255
|
+
borderColor: "transparent",
|
|
256
|
+
borderStyle: "dashed",
|
|
257
|
+
boxShadow: "none"
|
|
258
|
+
},
|
|
259
|
+
related: { settings: Tt }
|
|
260
|
+
};
|
|
261
|
+
const br = () => {
|
|
262
|
+
const { connectors: e } = xe(), t = [
|
|
263
|
+
{
|
|
264
|
+
name: "Div",
|
|
265
|
+
icon: ye,
|
|
266
|
+
element: /* @__PURE__ */ l(ie, { is: tt, canvas: !0 })
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: "Container",
|
|
270
|
+
icon: ye,
|
|
271
|
+
element: /* @__PURE__ */ l(ie, { is: Ae, canvas: !0 })
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
name: "Columns",
|
|
275
|
+
icon: Ot,
|
|
276
|
+
element: /* @__PURE__ */ B(ie, { is: Pt, canvas: !0, children: [
|
|
277
|
+
/* @__PURE__ */ l(ie, { is: Ae, canvas: !0 }),
|
|
278
|
+
/* @__PURE__ */ l(ie, { is: Ae, canvas: !0 })
|
|
279
|
+
] })
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: "Section",
|
|
283
|
+
icon: ye,
|
|
284
|
+
element: /* @__PURE__ */ l(ie, { is: kt, canvas: !0 })
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
name: "Wrapper",
|
|
288
|
+
icon: ye,
|
|
289
|
+
element: /* @__PURE__ */ l(ie, { is: et, canvas: !0 })
|
|
290
|
+
}
|
|
291
|
+
], o = [
|
|
292
|
+
{
|
|
293
|
+
name: "Heading",
|
|
294
|
+
icon: Bt,
|
|
295
|
+
element: /* @__PURE__ */ l(It, {})
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: "Text",
|
|
299
|
+
icon: Gt,
|
|
300
|
+
element: /* @__PURE__ */ l(Dt, {})
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
name: "Button",
|
|
304
|
+
icon: Vt,
|
|
305
|
+
element: /* @__PURE__ */ l(At, {})
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
name: "Link",
|
|
309
|
+
icon: Rt,
|
|
310
|
+
element: /* @__PURE__ */ l(Mt, {})
|
|
311
|
+
}
|
|
312
|
+
], r = [
|
|
313
|
+
{
|
|
314
|
+
name: "Image",
|
|
315
|
+
icon: Ft,
|
|
316
|
+
element: /* @__PURE__ */ l(_t, {})
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
name: "Video",
|
|
320
|
+
icon: Go,
|
|
321
|
+
element: /* @__PURE__ */ l(Lt, {})
|
|
322
|
+
}
|
|
323
|
+
], n = [
|
|
324
|
+
{
|
|
325
|
+
name: "Divider",
|
|
326
|
+
icon: Ht,
|
|
327
|
+
element: /* @__PURE__ */ l(zt, {})
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
name: "Spacer",
|
|
331
|
+
icon: jt,
|
|
332
|
+
element: /* @__PURE__ */ l($t, {})
|
|
333
|
+
}
|
|
334
|
+
], s = (i, c) => /* @__PURE__ */ B("div", { className: "space-y-2", children: [
|
|
335
|
+
/* @__PURE__ */ l("span", { className: "text-xs text-muted-foreground/70", children: i }),
|
|
336
|
+
/* @__PURE__ */ l("div", { className: "grid grid-cols-2 gap-1.5", children: c.map((d) => /* @__PURE__ */ B(
|
|
337
|
+
De,
|
|
338
|
+
{
|
|
339
|
+
variant: "outline",
|
|
340
|
+
size: "sm",
|
|
341
|
+
className: "flex flex-col items-center justify-center h-14 cursor-grab active:cursor-grabbing text-muted-foreground hover:text-foreground",
|
|
342
|
+
ref: (u) => u && e.create(u, d.element),
|
|
343
|
+
children: [
|
|
344
|
+
/* @__PURE__ */ l(d.icon, { className: "h-4 w-4 mb-1" }),
|
|
345
|
+
/* @__PURE__ */ l("span", { className: "text-[10px]", children: d.name })
|
|
346
|
+
]
|
|
347
|
+
},
|
|
348
|
+
d.name
|
|
349
|
+
)) })
|
|
350
|
+
] });
|
|
351
|
+
return /* @__PURE__ */ B("div", { className: "space-y-4", children: [
|
|
352
|
+
/* @__PURE__ */ l("h3", { className: "text-sm font-medium text-muted-foreground", children: "Components" }),
|
|
353
|
+
s("Layout", t),
|
|
354
|
+
s("Basic", o),
|
|
355
|
+
s("Media", r),
|
|
356
|
+
s("Utility", n)
|
|
357
|
+
] });
|
|
358
|
+
};
|
|
359
|
+
var yr = p.createContext(void 0);
|
|
360
|
+
function ot(e) {
|
|
361
|
+
const t = p.useContext(yr);
|
|
362
|
+
return e || t || "ltr";
|
|
363
|
+
}
|
|
364
|
+
function wr(e, [t, o]) {
|
|
365
|
+
return Math.min(o, Math.max(t, e));
|
|
366
|
+
}
|
|
367
|
+
function xr(e, t) {
|
|
368
|
+
return p.useReducer((o, r) => t[o][r] ?? o, e);
|
|
369
|
+
}
|
|
370
|
+
var rt = "ScrollArea", [Wt] = ze(rt), [Sr, K] = Wt(rt), Yt = p.forwardRef(
|
|
371
|
+
(e, t) => {
|
|
372
|
+
const {
|
|
373
|
+
__scopeScrollArea: o,
|
|
374
|
+
type: r = "hover",
|
|
375
|
+
dir: n,
|
|
376
|
+
scrollHideDelay: s = 600,
|
|
377
|
+
...i
|
|
378
|
+
} = e, [c, d] = p.useState(null), [u, f] = p.useState(null), [h, g] = p.useState(null), [a, N] = p.useState(null), [v, b] = p.useState(null), [C, S] = p.useState(0), [w, T] = p.useState(0), [z, R] = p.useState(!1), [k, D] = p.useState(!1), P = re(t, (F) => d(F)), M = ot(n);
|
|
379
|
+
return /* @__PURE__ */ l(
|
|
380
|
+
Sr,
|
|
381
|
+
{
|
|
382
|
+
scope: o,
|
|
383
|
+
type: r,
|
|
384
|
+
dir: M,
|
|
385
|
+
scrollHideDelay: s,
|
|
386
|
+
scrollArea: c,
|
|
387
|
+
viewport: u,
|
|
388
|
+
onViewportChange: f,
|
|
389
|
+
content: h,
|
|
390
|
+
onContentChange: g,
|
|
391
|
+
scrollbarX: a,
|
|
392
|
+
onScrollbarXChange: N,
|
|
393
|
+
scrollbarXEnabled: z,
|
|
394
|
+
onScrollbarXEnabledChange: R,
|
|
395
|
+
scrollbarY: v,
|
|
396
|
+
onScrollbarYChange: b,
|
|
397
|
+
scrollbarYEnabled: k,
|
|
398
|
+
onScrollbarYEnabledChange: D,
|
|
399
|
+
onCornerWidthChange: S,
|
|
400
|
+
onCornerHeightChange: T,
|
|
401
|
+
children: /* @__PURE__ */ l(
|
|
402
|
+
te.div,
|
|
403
|
+
{
|
|
404
|
+
dir: M,
|
|
405
|
+
...i,
|
|
406
|
+
ref: P,
|
|
407
|
+
style: {
|
|
408
|
+
position: "relative",
|
|
409
|
+
// Pass corner sizes as CSS vars to reduce re-renders of context consumers
|
|
410
|
+
"--radix-scroll-area-corner-width": C + "px",
|
|
411
|
+
"--radix-scroll-area-corner-height": w + "px",
|
|
412
|
+
...e.style
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
)
|
|
416
|
+
}
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
);
|
|
420
|
+
Yt.displayName = rt;
|
|
421
|
+
var Ut = "ScrollAreaViewport", Xt = p.forwardRef(
|
|
422
|
+
(e, t) => {
|
|
423
|
+
const { __scopeScrollArea: o, children: r, nonce: n, ...s } = e, i = K(Ut, o), c = p.useRef(null), d = re(t, c, i.onViewportChange);
|
|
424
|
+
return /* @__PURE__ */ B(Et, { children: [
|
|
425
|
+
/* @__PURE__ */ l(
|
|
426
|
+
"style",
|
|
427
|
+
{
|
|
428
|
+
dangerouslySetInnerHTML: {
|
|
429
|
+
__html: "[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"
|
|
430
|
+
},
|
|
431
|
+
nonce: n
|
|
432
|
+
}
|
|
433
|
+
),
|
|
434
|
+
/* @__PURE__ */ l(
|
|
435
|
+
te.div,
|
|
436
|
+
{
|
|
437
|
+
"data-radix-scroll-area-viewport": "",
|
|
438
|
+
...s,
|
|
439
|
+
ref: d,
|
|
440
|
+
style: {
|
|
441
|
+
/**
|
|
442
|
+
* We don't support `visible` because the intention is to have at least one scrollbar
|
|
443
|
+
* if this component is used and `visible` will behave like `auto` in that case
|
|
444
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description
|
|
445
|
+
*
|
|
446
|
+
* We don't handle `auto` because the intention is for the native implementation
|
|
447
|
+
* to be hidden if using this component. We just want to ensure the node is scrollable
|
|
448
|
+
* so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
|
|
449
|
+
* the browser from having to work out whether to render native scrollbars or not,
|
|
450
|
+
* we tell it to with the intention of hiding them in CSS.
|
|
451
|
+
*/
|
|
452
|
+
overflowX: i.scrollbarXEnabled ? "scroll" : "hidden",
|
|
453
|
+
overflowY: i.scrollbarYEnabled ? "scroll" : "hidden",
|
|
454
|
+
...e.style
|
|
455
|
+
},
|
|
456
|
+
children: /* @__PURE__ */ l("div", { ref: i.onContentChange, style: { minWidth: "100%", display: "table" }, children: r })
|
|
457
|
+
}
|
|
458
|
+
)
|
|
459
|
+
] });
|
|
460
|
+
}
|
|
461
|
+
);
|
|
462
|
+
Xt.displayName = Ut;
|
|
463
|
+
var oe = "ScrollAreaScrollbar", nt = p.forwardRef(
|
|
464
|
+
(e, t) => {
|
|
465
|
+
const { forceMount: o, ...r } = e, n = K(oe, e.__scopeScrollArea), { onScrollbarXEnabledChange: s, onScrollbarYEnabledChange: i } = n, c = e.orientation === "horizontal";
|
|
466
|
+
return p.useEffect(() => (c ? s(!0) : i(!0), () => {
|
|
467
|
+
c ? s(!1) : i(!1);
|
|
468
|
+
}), [c, s, i]), n.type === "hover" ? /* @__PURE__ */ l(Cr, { ...r, ref: t, forceMount: o }) : n.type === "scroll" ? /* @__PURE__ */ l(Er, { ...r, ref: t, forceMount: o }) : n.type === "auto" ? /* @__PURE__ */ l(Kt, { ...r, ref: t, forceMount: o }) : n.type === "always" ? /* @__PURE__ */ l(at, { ...r, ref: t }) : null;
|
|
469
|
+
}
|
|
470
|
+
);
|
|
471
|
+
nt.displayName = oe;
|
|
472
|
+
var Cr = p.forwardRef((e, t) => {
|
|
473
|
+
const { forceMount: o, ...r } = e, n = K(oe, e.__scopeScrollArea), [s, i] = p.useState(!1);
|
|
474
|
+
return p.useEffect(() => {
|
|
475
|
+
const c = n.scrollArea;
|
|
476
|
+
let d = 0;
|
|
477
|
+
if (c) {
|
|
478
|
+
const u = () => {
|
|
479
|
+
window.clearTimeout(d), i(!0);
|
|
480
|
+
}, f = () => {
|
|
481
|
+
d = window.setTimeout(() => i(!1), n.scrollHideDelay);
|
|
482
|
+
};
|
|
483
|
+
return c.addEventListener("pointerenter", u), c.addEventListener("pointerleave", f), () => {
|
|
484
|
+
window.clearTimeout(d), c.removeEventListener("pointerenter", u), c.removeEventListener("pointerleave", f);
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
}, [n.scrollArea, n.scrollHideDelay]), /* @__PURE__ */ l($e, { present: o || s, children: /* @__PURE__ */ l(
|
|
488
|
+
Kt,
|
|
489
|
+
{
|
|
490
|
+
"data-state": s ? "visible" : "hidden",
|
|
491
|
+
...r,
|
|
492
|
+
ref: t
|
|
493
|
+
}
|
|
494
|
+
) });
|
|
495
|
+
}), Er = p.forwardRef((e, t) => {
|
|
496
|
+
const { forceMount: o, ...r } = e, n = K(oe, e.__scopeScrollArea), s = e.orientation === "horizontal", i = Fe(() => d("SCROLL_END"), 100), [c, d] = xr("hidden", {
|
|
497
|
+
hidden: {
|
|
498
|
+
SCROLL: "scrolling"
|
|
499
|
+
},
|
|
500
|
+
scrolling: {
|
|
501
|
+
SCROLL_END: "idle",
|
|
502
|
+
POINTER_ENTER: "interacting"
|
|
503
|
+
},
|
|
504
|
+
interacting: {
|
|
505
|
+
SCROLL: "interacting",
|
|
506
|
+
POINTER_LEAVE: "idle"
|
|
507
|
+
},
|
|
508
|
+
idle: {
|
|
509
|
+
HIDE: "hidden",
|
|
510
|
+
SCROLL: "scrolling",
|
|
511
|
+
POINTER_ENTER: "interacting"
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
return p.useEffect(() => {
|
|
515
|
+
if (c === "idle") {
|
|
516
|
+
const u = window.setTimeout(() => d("HIDE"), n.scrollHideDelay);
|
|
517
|
+
return () => window.clearTimeout(u);
|
|
518
|
+
}
|
|
519
|
+
}, [c, n.scrollHideDelay, d]), p.useEffect(() => {
|
|
520
|
+
const u = n.viewport, f = s ? "scrollLeft" : "scrollTop";
|
|
521
|
+
if (u) {
|
|
522
|
+
let h = u[f];
|
|
523
|
+
const g = () => {
|
|
524
|
+
const a = u[f];
|
|
525
|
+
h !== a && (d("SCROLL"), i()), h = a;
|
|
526
|
+
};
|
|
527
|
+
return u.addEventListener("scroll", g), () => u.removeEventListener("scroll", g);
|
|
528
|
+
}
|
|
529
|
+
}, [n.viewport, s, d, i]), /* @__PURE__ */ l($e, { present: o || c !== "hidden", children: /* @__PURE__ */ l(
|
|
530
|
+
at,
|
|
531
|
+
{
|
|
532
|
+
"data-state": c === "hidden" ? "hidden" : "visible",
|
|
533
|
+
...r,
|
|
534
|
+
ref: t,
|
|
535
|
+
onPointerEnter: W(e.onPointerEnter, () => d("POINTER_ENTER")),
|
|
536
|
+
onPointerLeave: W(e.onPointerLeave, () => d("POINTER_LEAVE"))
|
|
537
|
+
}
|
|
538
|
+
) });
|
|
539
|
+
}), Kt = p.forwardRef((e, t) => {
|
|
540
|
+
const o = K(oe, e.__scopeScrollArea), { forceMount: r, ...n } = e, [s, i] = p.useState(!1), c = e.orientation === "horizontal", d = Fe(() => {
|
|
541
|
+
if (o.viewport) {
|
|
542
|
+
const u = o.viewport.offsetWidth < o.viewport.scrollWidth, f = o.viewport.offsetHeight < o.viewport.scrollHeight;
|
|
543
|
+
i(c ? u : f);
|
|
544
|
+
}
|
|
545
|
+
}, 10);
|
|
546
|
+
return we(o.viewport, d), we(o.content, d), /* @__PURE__ */ l($e, { present: r || s, children: /* @__PURE__ */ l(
|
|
547
|
+
at,
|
|
548
|
+
{
|
|
549
|
+
"data-state": s ? "visible" : "hidden",
|
|
550
|
+
...n,
|
|
551
|
+
ref: t
|
|
552
|
+
}
|
|
553
|
+
) });
|
|
554
|
+
}), at = p.forwardRef((e, t) => {
|
|
555
|
+
const { orientation: o = "vertical", ...r } = e, n = K(oe, e.__scopeScrollArea), s = p.useRef(null), i = p.useRef(0), [c, d] = p.useState({
|
|
556
|
+
content: 0,
|
|
557
|
+
viewport: 0,
|
|
558
|
+
scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
|
|
559
|
+
}), u = eo(c.viewport, c.content), f = {
|
|
560
|
+
...r,
|
|
561
|
+
sizes: c,
|
|
562
|
+
onSizesChange: d,
|
|
563
|
+
hasThumb: u > 0 && u < 1,
|
|
564
|
+
onThumbChange: (g) => s.current = g,
|
|
565
|
+
onThumbPointerUp: () => i.current = 0,
|
|
566
|
+
onThumbPointerDown: (g) => i.current = g
|
|
567
|
+
};
|
|
568
|
+
function h(g, a) {
|
|
569
|
+
return Ir(g, i.current, c, a);
|
|
570
|
+
}
|
|
571
|
+
return o === "horizontal" ? /* @__PURE__ */ l(
|
|
572
|
+
Nr,
|
|
573
|
+
{
|
|
574
|
+
...f,
|
|
575
|
+
ref: t,
|
|
576
|
+
onThumbPositionChange: () => {
|
|
577
|
+
if (n.viewport && s.current) {
|
|
578
|
+
const g = n.viewport.scrollLeft, a = yt(g, c, n.dir);
|
|
579
|
+
s.current.style.transform = `translate3d(${a}px, 0, 0)`;
|
|
580
|
+
}
|
|
581
|
+
},
|
|
582
|
+
onWheelScroll: (g) => {
|
|
583
|
+
n.viewport && (n.viewport.scrollLeft = g);
|
|
584
|
+
},
|
|
585
|
+
onDragScroll: (g) => {
|
|
586
|
+
n.viewport && (n.viewport.scrollLeft = h(g, n.dir));
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
) : o === "vertical" ? /* @__PURE__ */ l(
|
|
590
|
+
Tr,
|
|
591
|
+
{
|
|
592
|
+
...f,
|
|
593
|
+
ref: t,
|
|
594
|
+
onThumbPositionChange: () => {
|
|
595
|
+
if (n.viewport && s.current) {
|
|
596
|
+
const g = n.viewport.scrollTop, a = yt(g, c);
|
|
597
|
+
s.current.style.transform = `translate3d(0, ${a}px, 0)`;
|
|
598
|
+
}
|
|
599
|
+
},
|
|
600
|
+
onWheelScroll: (g) => {
|
|
601
|
+
n.viewport && (n.viewport.scrollTop = g);
|
|
602
|
+
},
|
|
603
|
+
onDragScroll: (g) => {
|
|
604
|
+
n.viewport && (n.viewport.scrollTop = h(g));
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
) : null;
|
|
608
|
+
}), Nr = p.forwardRef((e, t) => {
|
|
609
|
+
const { sizes: o, onSizesChange: r, ...n } = e, s = K(oe, e.__scopeScrollArea), [i, c] = p.useState(), d = p.useRef(null), u = re(t, d, s.onScrollbarXChange);
|
|
610
|
+
return p.useEffect(() => {
|
|
611
|
+
d.current && c(getComputedStyle(d.current));
|
|
612
|
+
}, [d]), /* @__PURE__ */ l(
|
|
613
|
+
Qt,
|
|
614
|
+
{
|
|
615
|
+
"data-orientation": "horizontal",
|
|
616
|
+
...n,
|
|
617
|
+
ref: u,
|
|
618
|
+
sizes: o,
|
|
619
|
+
style: {
|
|
620
|
+
bottom: 0,
|
|
621
|
+
left: s.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
622
|
+
right: s.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
623
|
+
"--radix-scroll-area-thumb-width": Be(o) + "px",
|
|
624
|
+
...e.style
|
|
625
|
+
},
|
|
626
|
+
onThumbPointerDown: (f) => e.onThumbPointerDown(f.x),
|
|
627
|
+
onDragScroll: (f) => e.onDragScroll(f.x),
|
|
628
|
+
onWheelScroll: (f, h) => {
|
|
629
|
+
if (s.viewport) {
|
|
630
|
+
const g = s.viewport.scrollLeft + f.deltaX;
|
|
631
|
+
e.onWheelScroll(g), oo(g, h) && f.preventDefault();
|
|
632
|
+
}
|
|
633
|
+
},
|
|
634
|
+
onResize: () => {
|
|
635
|
+
d.current && s.viewport && i && r({
|
|
636
|
+
content: s.viewport.scrollWidth,
|
|
637
|
+
viewport: s.viewport.offsetWidth,
|
|
638
|
+
scrollbar: {
|
|
639
|
+
size: d.current.clientWidth,
|
|
640
|
+
paddingStart: _e(i.paddingLeft),
|
|
641
|
+
paddingEnd: _e(i.paddingRight)
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
);
|
|
647
|
+
}), Tr = p.forwardRef((e, t) => {
|
|
648
|
+
const { sizes: o, onSizesChange: r, ...n } = e, s = K(oe, e.__scopeScrollArea), [i, c] = p.useState(), d = p.useRef(null), u = re(t, d, s.onScrollbarYChange);
|
|
649
|
+
return p.useEffect(() => {
|
|
650
|
+
d.current && c(getComputedStyle(d.current));
|
|
651
|
+
}, [d]), /* @__PURE__ */ l(
|
|
652
|
+
Qt,
|
|
653
|
+
{
|
|
654
|
+
"data-orientation": "vertical",
|
|
655
|
+
...n,
|
|
656
|
+
ref: u,
|
|
657
|
+
sizes: o,
|
|
658
|
+
style: {
|
|
659
|
+
top: 0,
|
|
660
|
+
right: s.dir === "ltr" ? 0 : void 0,
|
|
661
|
+
left: s.dir === "rtl" ? 0 : void 0,
|
|
662
|
+
bottom: "var(--radix-scroll-area-corner-height)",
|
|
663
|
+
"--radix-scroll-area-thumb-height": Be(o) + "px",
|
|
664
|
+
...e.style
|
|
665
|
+
},
|
|
666
|
+
onThumbPointerDown: (f) => e.onThumbPointerDown(f.y),
|
|
667
|
+
onDragScroll: (f) => e.onDragScroll(f.y),
|
|
668
|
+
onWheelScroll: (f, h) => {
|
|
669
|
+
if (s.viewport) {
|
|
670
|
+
const g = s.viewport.scrollTop + f.deltaY;
|
|
671
|
+
e.onWheelScroll(g), oo(g, h) && f.preventDefault();
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
onResize: () => {
|
|
675
|
+
d.current && s.viewport && i && r({
|
|
676
|
+
content: s.viewport.scrollHeight,
|
|
677
|
+
viewport: s.viewport.offsetHeight,
|
|
678
|
+
scrollbar: {
|
|
679
|
+
size: d.current.clientHeight,
|
|
680
|
+
paddingStart: _e(i.paddingTop),
|
|
681
|
+
paddingEnd: _e(i.paddingBottom)
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
);
|
|
687
|
+
}), [Rr, qt] = Wt(oe), Qt = p.forwardRef((e, t) => {
|
|
688
|
+
const {
|
|
689
|
+
__scopeScrollArea: o,
|
|
690
|
+
sizes: r,
|
|
691
|
+
hasThumb: n,
|
|
692
|
+
onThumbChange: s,
|
|
693
|
+
onThumbPointerUp: i,
|
|
694
|
+
onThumbPointerDown: c,
|
|
695
|
+
onThumbPositionChange: d,
|
|
696
|
+
onDragScroll: u,
|
|
697
|
+
onWheelScroll: f,
|
|
698
|
+
onResize: h,
|
|
699
|
+
...g
|
|
700
|
+
} = e, a = K(oe, o), [N, v] = p.useState(null), b = re(t, (P) => v(P)), C = p.useRef(null), S = p.useRef(""), w = a.viewport, T = r.content - r.viewport, z = ce(f), R = ce(d), k = Fe(h, 10);
|
|
701
|
+
function D(P) {
|
|
702
|
+
if (C.current) {
|
|
703
|
+
const M = P.clientX - C.current.left, F = P.clientY - C.current.top;
|
|
704
|
+
u({ x: M, y: F });
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return p.useEffect(() => {
|
|
708
|
+
const P = (M) => {
|
|
709
|
+
const F = M.target;
|
|
710
|
+
(N == null ? void 0 : N.contains(F)) && z(M, T);
|
|
711
|
+
};
|
|
712
|
+
return document.addEventListener("wheel", P, { passive: !1 }), () => document.removeEventListener("wheel", P, { passive: !1 });
|
|
713
|
+
}, [w, N, T, z]), p.useEffect(R, [r, R]), we(N, k), we(a.content, k), /* @__PURE__ */ l(
|
|
714
|
+
Rr,
|
|
715
|
+
{
|
|
716
|
+
scope: o,
|
|
717
|
+
scrollbar: N,
|
|
718
|
+
hasThumb: n,
|
|
719
|
+
onThumbChange: ce(s),
|
|
720
|
+
onThumbPointerUp: ce(i),
|
|
721
|
+
onThumbPositionChange: R,
|
|
722
|
+
onThumbPointerDown: ce(c),
|
|
723
|
+
children: /* @__PURE__ */ l(
|
|
724
|
+
te.div,
|
|
725
|
+
{
|
|
726
|
+
...g,
|
|
727
|
+
ref: b,
|
|
728
|
+
style: { position: "absolute", ...g.style },
|
|
729
|
+
onPointerDown: W(e.onPointerDown, (P) => {
|
|
730
|
+
P.button === 0 && (P.target.setPointerCapture(P.pointerId), C.current = N.getBoundingClientRect(), S.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", a.viewport && (a.viewport.style.scrollBehavior = "auto"), D(P));
|
|
731
|
+
}),
|
|
732
|
+
onPointerMove: W(e.onPointerMove, D),
|
|
733
|
+
onPointerUp: W(e.onPointerUp, (P) => {
|
|
734
|
+
const M = P.target;
|
|
735
|
+
M.hasPointerCapture(P.pointerId) && M.releasePointerCapture(P.pointerId), document.body.style.webkitUserSelect = S.current, a.viewport && (a.viewport.style.scrollBehavior = ""), C.current = null;
|
|
736
|
+
})
|
|
737
|
+
}
|
|
738
|
+
)
|
|
739
|
+
}
|
|
740
|
+
);
|
|
741
|
+
}), Me = "ScrollAreaThumb", Zt = p.forwardRef(
|
|
742
|
+
(e, t) => {
|
|
743
|
+
const { forceMount: o, ...r } = e, n = qt(Me, e.__scopeScrollArea);
|
|
744
|
+
return /* @__PURE__ */ l($e, { present: o || n.hasThumb, children: /* @__PURE__ */ l(Pr, { ref: t, ...r }) });
|
|
745
|
+
}
|
|
746
|
+
), Pr = p.forwardRef(
|
|
747
|
+
(e, t) => {
|
|
748
|
+
const { __scopeScrollArea: o, style: r, ...n } = e, s = K(Me, o), i = qt(Me, o), { onThumbPositionChange: c } = i, d = re(
|
|
749
|
+
t,
|
|
750
|
+
(h) => i.onThumbChange(h)
|
|
751
|
+
), u = p.useRef(void 0), f = Fe(() => {
|
|
752
|
+
u.current && (u.current(), u.current = void 0);
|
|
753
|
+
}, 100);
|
|
754
|
+
return p.useEffect(() => {
|
|
755
|
+
const h = s.viewport;
|
|
756
|
+
if (h) {
|
|
757
|
+
const g = () => {
|
|
758
|
+
if (f(), !u.current) {
|
|
759
|
+
const a = Dr(h, c);
|
|
760
|
+
u.current = a, c();
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
return c(), h.addEventListener("scroll", g), () => h.removeEventListener("scroll", g);
|
|
764
|
+
}
|
|
765
|
+
}, [s.viewport, f, c]), /* @__PURE__ */ l(
|
|
766
|
+
te.div,
|
|
767
|
+
{
|
|
768
|
+
"data-state": i.hasThumb ? "visible" : "hidden",
|
|
769
|
+
...n,
|
|
770
|
+
ref: d,
|
|
771
|
+
style: {
|
|
772
|
+
width: "var(--radix-scroll-area-thumb-width)",
|
|
773
|
+
height: "var(--radix-scroll-area-thumb-height)",
|
|
774
|
+
...r
|
|
775
|
+
},
|
|
776
|
+
onPointerDownCapture: W(e.onPointerDownCapture, (h) => {
|
|
777
|
+
const a = h.target.getBoundingClientRect(), N = h.clientX - a.left, v = h.clientY - a.top;
|
|
778
|
+
i.onThumbPointerDown({ x: N, y: v });
|
|
779
|
+
}),
|
|
780
|
+
onPointerUp: W(e.onPointerUp, i.onThumbPointerUp)
|
|
781
|
+
}
|
|
782
|
+
);
|
|
783
|
+
}
|
|
784
|
+
);
|
|
785
|
+
Zt.displayName = Me;
|
|
786
|
+
var st = "ScrollAreaCorner", Jt = p.forwardRef(
|
|
787
|
+
(e, t) => {
|
|
788
|
+
const o = K(st, e.__scopeScrollArea), r = !!(o.scrollbarX && o.scrollbarY);
|
|
789
|
+
return o.type !== "scroll" && r ? /* @__PURE__ */ l(kr, { ...e, ref: t }) : null;
|
|
790
|
+
}
|
|
791
|
+
);
|
|
792
|
+
Jt.displayName = st;
|
|
793
|
+
var kr = p.forwardRef((e, t) => {
|
|
794
|
+
const { __scopeScrollArea: o, ...r } = e, n = K(st, o), [s, i] = p.useState(0), [c, d] = p.useState(0), u = !!(s && c);
|
|
795
|
+
return we(n.scrollbarX, () => {
|
|
796
|
+
var h;
|
|
797
|
+
const f = ((h = n.scrollbarX) == null ? void 0 : h.offsetHeight) || 0;
|
|
798
|
+
n.onCornerHeightChange(f), d(f);
|
|
799
|
+
}), we(n.scrollbarY, () => {
|
|
800
|
+
var h;
|
|
801
|
+
const f = ((h = n.scrollbarY) == null ? void 0 : h.offsetWidth) || 0;
|
|
802
|
+
n.onCornerWidthChange(f), i(f);
|
|
803
|
+
}), u ? /* @__PURE__ */ l(
|
|
804
|
+
te.div,
|
|
805
|
+
{
|
|
806
|
+
...r,
|
|
807
|
+
ref: t,
|
|
808
|
+
style: {
|
|
809
|
+
width: s,
|
|
810
|
+
height: c,
|
|
811
|
+
position: "absolute",
|
|
812
|
+
right: n.dir === "ltr" ? 0 : void 0,
|
|
813
|
+
left: n.dir === "rtl" ? 0 : void 0,
|
|
814
|
+
bottom: 0,
|
|
815
|
+
...e.style
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
) : null;
|
|
819
|
+
});
|
|
820
|
+
function _e(e) {
|
|
821
|
+
return e ? parseInt(e, 10) : 0;
|
|
822
|
+
}
|
|
823
|
+
function eo(e, t) {
|
|
824
|
+
const o = e / t;
|
|
825
|
+
return isNaN(o) ? 0 : o;
|
|
826
|
+
}
|
|
827
|
+
function Be(e) {
|
|
828
|
+
const t = eo(e.viewport, e.content), o = e.scrollbar.paddingStart + e.scrollbar.paddingEnd, r = (e.scrollbar.size - o) * t;
|
|
829
|
+
return Math.max(r, 18);
|
|
830
|
+
}
|
|
831
|
+
function Ir(e, t, o, r = "ltr") {
|
|
832
|
+
const n = Be(o), s = n / 2, i = t || s, c = n - i, d = o.scrollbar.paddingStart + i, u = o.scrollbar.size - o.scrollbar.paddingEnd - c, f = o.content - o.viewport, h = r === "ltr" ? [0, f] : [f * -1, 0];
|
|
833
|
+
return to([d, u], h)(e);
|
|
834
|
+
}
|
|
835
|
+
function yt(e, t, o = "ltr") {
|
|
836
|
+
const r = Be(t), n = t.scrollbar.paddingStart + t.scrollbar.paddingEnd, s = t.scrollbar.size - n, i = t.content - t.viewport, c = s - r, d = o === "ltr" ? [0, i] : [i * -1, 0], u = wr(e, d);
|
|
837
|
+
return to([0, i], [0, c])(u);
|
|
838
|
+
}
|
|
839
|
+
function to(e, t) {
|
|
840
|
+
return (o) => {
|
|
841
|
+
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
842
|
+
const r = (t[1] - t[0]) / (e[1] - e[0]);
|
|
843
|
+
return t[0] + r * (o - e[0]);
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
function oo(e, t) {
|
|
847
|
+
return e > 0 && e < t;
|
|
848
|
+
}
|
|
849
|
+
var Dr = (e, t = () => {
|
|
850
|
+
}) => {
|
|
851
|
+
let o = { left: e.scrollLeft, top: e.scrollTop }, r = 0;
|
|
852
|
+
return function n() {
|
|
853
|
+
const s = { left: e.scrollLeft, top: e.scrollTop }, i = o.left !== s.left, c = o.top !== s.top;
|
|
854
|
+
(i || c) && t(), o = s, r = window.requestAnimationFrame(n);
|
|
855
|
+
}(), () => window.cancelAnimationFrame(r);
|
|
856
|
+
};
|
|
857
|
+
function Fe(e, t) {
|
|
858
|
+
const o = ce(e), r = p.useRef(0);
|
|
859
|
+
return p.useEffect(() => () => window.clearTimeout(r.current), []), p.useCallback(() => {
|
|
860
|
+
window.clearTimeout(r.current), r.current = window.setTimeout(o, t);
|
|
861
|
+
}, [o, t]);
|
|
862
|
+
}
|
|
863
|
+
function we(e, t) {
|
|
864
|
+
const o = ce(t);
|
|
865
|
+
Wo(() => {
|
|
866
|
+
let r = 0;
|
|
867
|
+
if (e) {
|
|
868
|
+
const n = new ResizeObserver(() => {
|
|
869
|
+
cancelAnimationFrame(r), r = window.requestAnimationFrame(o);
|
|
870
|
+
});
|
|
871
|
+
return n.observe(e), () => {
|
|
872
|
+
window.cancelAnimationFrame(r), n.unobserve(e);
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
}, [e, o]);
|
|
876
|
+
}
|
|
877
|
+
var ro = Yt, Ar = Xt, Mr = Jt;
|
|
878
|
+
const lt = p.forwardRef(({ className: e, children: t, ...o }, r) => /* @__PURE__ */ B(ro, { ref: r, className: Te("relative overflow-hidden", e), ...o, children: [
|
|
879
|
+
/* @__PURE__ */ l(Ar, { className: "h-full w-full rounded-[inherit]", children: t }),
|
|
880
|
+
/* @__PURE__ */ l(no, {}),
|
|
881
|
+
/* @__PURE__ */ l(Mr, {})
|
|
882
|
+
] }));
|
|
883
|
+
lt.displayName = ro.displayName;
|
|
884
|
+
const no = p.forwardRef(({ className: e, orientation: t = "vertical", ...o }, r) => /* @__PURE__ */ l(
|
|
885
|
+
nt,
|
|
886
|
+
{
|
|
887
|
+
ref: r,
|
|
888
|
+
orientation: t,
|
|
889
|
+
className: Te(
|
|
890
|
+
"flex touch-none select-none transition-colors",
|
|
891
|
+
t === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
892
|
+
t === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
893
|
+
e
|
|
894
|
+
),
|
|
895
|
+
...o,
|
|
896
|
+
children: /* @__PURE__ */ l(Zt, { className: "relative flex-1 rounded-full bg-border" })
|
|
897
|
+
}
|
|
898
|
+
));
|
|
899
|
+
no.displayName = nt.displayName;
|
|
900
|
+
const _r = () => {
|
|
901
|
+
const { selected: e, actions: t } = xe((o) => {
|
|
902
|
+
var s, i, c, d, u, f, h;
|
|
903
|
+
const r = o.events.selected ? Array.from(o.events.selected)[0] : null;
|
|
904
|
+
let n;
|
|
905
|
+
return r && (n = {
|
|
906
|
+
id: r,
|
|
907
|
+
name: ((i = (s = o.nodes[r]) == null ? void 0 : s.data) == null ? void 0 : i.displayName) || ((d = (c = o.nodes[r]) == null ? void 0 : c.data) == null ? void 0 : d.name),
|
|
908
|
+
settings: (f = (u = o.nodes[r]) == null ? void 0 : u.related) == null ? void 0 : f.settings,
|
|
909
|
+
isDeletable: ((h = o.nodes[r]) == null ? void 0 : h.id) !== "ROOT"
|
|
910
|
+
}), { selected: n };
|
|
911
|
+
});
|
|
912
|
+
return /* @__PURE__ */ l("div", { className: "h-full flex flex-col", children: e ? /* @__PURE__ */ B(Et, { children: [
|
|
913
|
+
/* @__PURE__ */ B("div", { className: "flex items-center justify-between pb-3 border-b border-border mb-3", children: [
|
|
914
|
+
/* @__PURE__ */ B("div", { children: [
|
|
915
|
+
/* @__PURE__ */ l("span", { className: "text-xs text-muted-foreground", children: "Selected" }),
|
|
916
|
+
/* @__PURE__ */ l("h3", { className: "text-sm font-semibold", children: e.name })
|
|
917
|
+
] }),
|
|
918
|
+
e.isDeletable && /* @__PURE__ */ l(
|
|
919
|
+
"button",
|
|
920
|
+
{
|
|
921
|
+
onClick: () => t.delete(e.id),
|
|
922
|
+
className: "p-1.5 rounded hover:bg-destructive/10 text-destructive transition-colors",
|
|
923
|
+
title: "Delete element",
|
|
924
|
+
children: /* @__PURE__ */ l(hr, { className: "h-4 w-4" })
|
|
925
|
+
}
|
|
926
|
+
)
|
|
927
|
+
] }),
|
|
928
|
+
/* @__PURE__ */ l(lt, { className: "flex-1 -mr-4 pr-4", children: e.settings && m.createElement(e.settings) })
|
|
929
|
+
] }) : /* @__PURE__ */ l("div", { className: "text-center py-8", children: /* @__PURE__ */ l("p", { className: "text-sm text-muted-foreground", children: "Select an element to edit its properties" }) }) });
|
|
930
|
+
}, Lr = (e) => {
|
|
931
|
+
switch (e) {
|
|
932
|
+
case "Container":
|
|
933
|
+
return ye;
|
|
934
|
+
case "Text":
|
|
935
|
+
return Gt;
|
|
936
|
+
case "Heading":
|
|
937
|
+
return Bt;
|
|
938
|
+
case "Button":
|
|
939
|
+
return Vt;
|
|
940
|
+
case "Image":
|
|
941
|
+
return Ft;
|
|
942
|
+
case "Divider":
|
|
943
|
+
return Ht;
|
|
944
|
+
case "Spacer":
|
|
945
|
+
return jt;
|
|
946
|
+
case "Video":
|
|
947
|
+
return vr;
|
|
948
|
+
case "Columns":
|
|
949
|
+
return Ot;
|
|
950
|
+
case "Link":
|
|
951
|
+
return Rt;
|
|
952
|
+
default:
|
|
953
|
+
return ye;
|
|
954
|
+
}
|
|
955
|
+
}, ao = ({ nodeId: e, depth: t = 0, onDragStart: o, onDragOver: r, onDrop: n, draggedId: s }) => {
|
|
956
|
+
const { node: i, actions: c, selectedNodeId: d, childNodes: u, parentId: f } = xe((E, ue) => {
|
|
957
|
+
var fe, x;
|
|
958
|
+
const V = E.nodes[e], ne = ((fe = V == null ? void 0 : V.data) == null ? void 0 : fe.nodes) || [], H = E.events.selected ? Array.from(E.events.selected)[0] : null, q = (x = V == null ? void 0 : V.data) == null ? void 0 : x.parent;
|
|
959
|
+
return {
|
|
960
|
+
node: V,
|
|
961
|
+
childNodes: ne,
|
|
962
|
+
selectedNodeId: H,
|
|
963
|
+
parentId: q
|
|
964
|
+
};
|
|
965
|
+
}), [h, g] = Ne(!0), [a, N] = Ne(!1);
|
|
966
|
+
if (!i) return null;
|
|
967
|
+
const v = i.data.displayName || i.data.name || "Unknown", b = u.length > 0, C = d === e, S = e === "ROOT", w = Lr(v), T = s === e, z = i.data.isCanvas, R = (E) => {
|
|
968
|
+
E.stopPropagation(), S || c.selectNode(e);
|
|
969
|
+
}, k = (E) => {
|
|
970
|
+
E.stopPropagation(), g(!h);
|
|
971
|
+
}, D = (E) => {
|
|
972
|
+
if (S) {
|
|
973
|
+
E.preventDefault();
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
E.stopPropagation(), o(e, f);
|
|
977
|
+
}, P = (E) => {
|
|
978
|
+
E.preventDefault(), E.stopPropagation(), s && s !== e && z && N(!0);
|
|
979
|
+
}, M = (E) => {
|
|
980
|
+
E.stopPropagation(), N(!1);
|
|
981
|
+
}, F = (E) => {
|
|
982
|
+
E.preventDefault(), E.stopPropagation(), N(!1), s && s !== e && n(e);
|
|
983
|
+
};
|
|
984
|
+
return /* @__PURE__ */ B("div", { className: "select-none", children: [
|
|
985
|
+
/* @__PURE__ */ B(
|
|
986
|
+
"div",
|
|
987
|
+
{
|
|
988
|
+
className: `flex items-center gap-1 py-1 px-1 rounded cursor-pointer text-sm transition-colors ${C ? "bg-primary/10 text-primary" : "hover:bg-secondary/50"} ${T ? "opacity-50" : ""} ${a ? "bg-primary/20 ring-1 ring-primary" : ""}`,
|
|
989
|
+
style: { paddingLeft: `${t * 12 + 4}px` },
|
|
990
|
+
onClick: R,
|
|
991
|
+
draggable: !S,
|
|
992
|
+
onDragStart: D,
|
|
993
|
+
onDragOver: P,
|
|
994
|
+
onDragLeave: M,
|
|
995
|
+
onDrop: F,
|
|
996
|
+
children: [
|
|
997
|
+
!S && /* @__PURE__ */ l(fr, { className: "h-3 w-3 text-muted-foreground/50 cursor-grab active:cursor-grabbing" }),
|
|
998
|
+
b ? /* @__PURE__ */ l("button", { onClick: k, className: "p-0.5 hover:bg-secondary rounded", children: h ? /* @__PURE__ */ l(Yo, { className: "h-3 w-3" }) : /* @__PURE__ */ l(Uo, { className: "h-3 w-3" }) }) : /* @__PURE__ */ l("span", { className: "w-4" }),
|
|
999
|
+
/* @__PURE__ */ l(w, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
|
|
1000
|
+
/* @__PURE__ */ l("span", { className: `truncate ${S ? "font-medium" : ""}`, children: S ? "Root" : v })
|
|
1001
|
+
]
|
|
1002
|
+
}
|
|
1003
|
+
),
|
|
1004
|
+
b && h && /* @__PURE__ */ l("div", { children: u.map((E) => /* @__PURE__ */ l(
|
|
1005
|
+
ao,
|
|
1006
|
+
{
|
|
1007
|
+
nodeId: E,
|
|
1008
|
+
depth: t + 1,
|
|
1009
|
+
onDragStart: o,
|
|
1010
|
+
onDragOver: r,
|
|
1011
|
+
onDrop: n,
|
|
1012
|
+
draggedId: s
|
|
1013
|
+
},
|
|
1014
|
+
E
|
|
1015
|
+
)) })
|
|
1016
|
+
] });
|
|
1017
|
+
}, zr = () => {
|
|
1018
|
+
const [e, t] = Ne(null), [o, r] = Ne(null), { nodeIds: n, actions: s } = xe((u) => ({
|
|
1019
|
+
nodeIds: Object.keys(u.nodes)
|
|
1020
|
+
})), i = (u, f) => {
|
|
1021
|
+
t(u), r(f);
|
|
1022
|
+
}, c = (u) => {
|
|
1023
|
+
if (e && u && e !== u)
|
|
1024
|
+
try {
|
|
1025
|
+
s.move(e, u, 0);
|
|
1026
|
+
} catch (f) {
|
|
1027
|
+
console.log("Cannot move node:", f);
|
|
1028
|
+
}
|
|
1029
|
+
t(null), r(null);
|
|
1030
|
+
};
|
|
1031
|
+
return /* @__PURE__ */ B("div", { className: "space-y-2", onDragEnd: () => {
|
|
1032
|
+
t(null), r(null);
|
|
1033
|
+
}, children: [
|
|
1034
|
+
/* @__PURE__ */ l("h3", { className: "text-sm font-medium text-muted-foreground", children: "Layers" }),
|
|
1035
|
+
/* @__PURE__ */ l("div", { className: "border border-border rounded-lg p-2 max-h-[250px] overflow-y-auto bg-background", children: n.includes("ROOT") && /* @__PURE__ */ l(
|
|
1036
|
+
ao,
|
|
1037
|
+
{
|
|
1038
|
+
nodeId: "ROOT",
|
|
1039
|
+
onDragStart: i,
|
|
1040
|
+
onDrop: c,
|
|
1041
|
+
draggedId: e
|
|
1042
|
+
}
|
|
1043
|
+
) }),
|
|
1044
|
+
/* @__PURE__ */ l("p", { className: "text-xs text-muted-foreground", children: "Drag to containers to reorder" })
|
|
1045
|
+
] });
|
|
1046
|
+
};
|
|
1047
|
+
// @__NO_SIDE_EFFECTS__
|
|
1048
|
+
function wt(e) {
|
|
1049
|
+
const t = /* @__PURE__ */ $r(e), o = p.forwardRef((r, n) => {
|
|
1050
|
+
const { children: s, ...i } = r, c = p.Children.toArray(s), d = c.find(Br);
|
|
1051
|
+
if (d) {
|
|
1052
|
+
const u = d.props.children, f = c.map((h) => h === d ? p.Children.count(u) > 1 ? p.Children.only(null) : p.isValidElement(u) ? u.props.children : null : h);
|
|
1053
|
+
return /* @__PURE__ */ l(t, { ...i, ref: n, children: p.isValidElement(u) ? p.cloneElement(u, void 0, f) : null });
|
|
1054
|
+
}
|
|
1055
|
+
return /* @__PURE__ */ l(t, { ...i, ref: n, children: s });
|
|
1056
|
+
});
|
|
1057
|
+
return o.displayName = `${e}.Slot`, o;
|
|
1058
|
+
}
|
|
1059
|
+
// @__NO_SIDE_EFFECTS__
|
|
1060
|
+
function $r(e) {
|
|
1061
|
+
const t = p.forwardRef((o, r) => {
|
|
1062
|
+
const { children: n, ...s } = o;
|
|
1063
|
+
if (p.isValidElement(n)) {
|
|
1064
|
+
const i = Hr(n), c = Fr(s, n.props);
|
|
1065
|
+
return n.type !== p.Fragment && (c.ref = r ? Xo(r, i) : i), p.cloneElement(n, c);
|
|
1066
|
+
}
|
|
1067
|
+
return p.Children.count(n) > 1 ? p.Children.only(null) : null;
|
|
1068
|
+
});
|
|
1069
|
+
return t.displayName = `${e}.SlotClone`, t;
|
|
1070
|
+
}
|
|
1071
|
+
var Or = Symbol("radix.slottable");
|
|
1072
|
+
function Br(e) {
|
|
1073
|
+
return p.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Or;
|
|
1074
|
+
}
|
|
1075
|
+
function Fr(e, t) {
|
|
1076
|
+
const o = { ...t };
|
|
1077
|
+
for (const r in t) {
|
|
1078
|
+
const n = e[r], s = t[r];
|
|
1079
|
+
/^on[A-Z]/.test(r) ? n && s ? o[r] = (...c) => {
|
|
1080
|
+
const d = s(...c);
|
|
1081
|
+
return n(...c), d;
|
|
1082
|
+
} : n && (o[r] = n) : r === "style" ? o[r] = { ...n, ...s } : r === "className" && (o[r] = [n, s].filter(Boolean).join(" "));
|
|
1083
|
+
}
|
|
1084
|
+
return { ...e, ...o };
|
|
1085
|
+
}
|
|
1086
|
+
function Hr(e) {
|
|
1087
|
+
var r, n;
|
|
1088
|
+
let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, o = t && "isReactWarning" in t && t.isReactWarning;
|
|
1089
|
+
return o ? e.ref : (t = (n = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : n.get, o = t && "isReactWarning" in t && t.isReactWarning, o ? e.props.ref : e.props.ref || e.ref);
|
|
1090
|
+
}
|
|
1091
|
+
function Vr(e) {
|
|
1092
|
+
const t = e + "CollectionProvider", [o, r] = ze(t), [n, s] = o(
|
|
1093
|
+
t,
|
|
1094
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
1095
|
+
), i = (v) => {
|
|
1096
|
+
const { scope: b, children: C } = v, S = m.useRef(null), w = m.useRef(/* @__PURE__ */ new Map()).current;
|
|
1097
|
+
return /* @__PURE__ */ l(n, { scope: b, itemMap: w, collectionRef: S, children: C });
|
|
1098
|
+
};
|
|
1099
|
+
i.displayName = t;
|
|
1100
|
+
const c = e + "CollectionSlot", d = /* @__PURE__ */ wt(c), u = m.forwardRef(
|
|
1101
|
+
(v, b) => {
|
|
1102
|
+
const { scope: C, children: S } = v, w = s(c, C), T = re(b, w.collectionRef);
|
|
1103
|
+
return /* @__PURE__ */ l(d, { ref: T, children: S });
|
|
1104
|
+
}
|
|
1105
|
+
);
|
|
1106
|
+
u.displayName = c;
|
|
1107
|
+
const f = e + "CollectionItemSlot", h = "data-radix-collection-item", g = /* @__PURE__ */ wt(f), a = m.forwardRef(
|
|
1108
|
+
(v, b) => {
|
|
1109
|
+
const { scope: C, children: S, ...w } = v, T = m.useRef(null), z = re(b, T), R = s(f, C);
|
|
1110
|
+
return m.useEffect(() => (R.itemMap.set(T, { ref: T, ...w }), () => void R.itemMap.delete(T))), /* @__PURE__ */ l(g, { [h]: "", ref: z, children: S });
|
|
1111
|
+
}
|
|
1112
|
+
);
|
|
1113
|
+
a.displayName = f;
|
|
1114
|
+
function N(v) {
|
|
1115
|
+
const b = s(e + "CollectionConsumer", v);
|
|
1116
|
+
return m.useCallback(() => {
|
|
1117
|
+
const S = b.collectionRef.current;
|
|
1118
|
+
if (!S) return [];
|
|
1119
|
+
const w = Array.from(S.querySelectorAll(`[${h}]`));
|
|
1120
|
+
return Array.from(b.itemMap.values()).sort(
|
|
1121
|
+
(R, k) => w.indexOf(R.ref.current) - w.indexOf(k.ref.current)
|
|
1122
|
+
);
|
|
1123
|
+
}, [b.collectionRef, b.itemMap]);
|
|
1124
|
+
}
|
|
1125
|
+
return [
|
|
1126
|
+
{ Provider: i, Slot: u, ItemSlot: a },
|
|
1127
|
+
N,
|
|
1128
|
+
r
|
|
1129
|
+
];
|
|
1130
|
+
}
|
|
1131
|
+
var qe = "rovingFocusGroup.onEntryFocus", jr = { bubbles: !1, cancelable: !0 }, Re = "RovingFocusGroup", [Qe, so, Gr] = Vr(Re), [Wr, lo] = ze(
|
|
1132
|
+
Re,
|
|
1133
|
+
[Gr]
|
|
1134
|
+
), [Yr, Ur] = Wr(Re), io = p.forwardRef(
|
|
1135
|
+
(e, t) => /* @__PURE__ */ l(Qe.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ l(Qe.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ l(Xr, { ...e, ref: t }) }) })
|
|
1136
|
+
);
|
|
1137
|
+
io.displayName = Re;
|
|
1138
|
+
var Xr = p.forwardRef((e, t) => {
|
|
1139
|
+
const {
|
|
1140
|
+
__scopeRovingFocusGroup: o,
|
|
1141
|
+
orientation: r,
|
|
1142
|
+
loop: n = !1,
|
|
1143
|
+
dir: s,
|
|
1144
|
+
currentTabStopId: i,
|
|
1145
|
+
defaultCurrentTabStopId: c,
|
|
1146
|
+
onCurrentTabStopIdChange: d,
|
|
1147
|
+
onEntryFocus: u,
|
|
1148
|
+
preventScrollOnEntryFocus: f = !1,
|
|
1149
|
+
...h
|
|
1150
|
+
} = e, g = p.useRef(null), a = re(t, g), N = ot(s), [v, b] = Oe({
|
|
1151
|
+
prop: i,
|
|
1152
|
+
defaultProp: c ?? null,
|
|
1153
|
+
onChange: d,
|
|
1154
|
+
caller: Re
|
|
1155
|
+
}), [C, S] = p.useState(!1), w = ce(u), T = so(o), z = p.useRef(!1), [R, k] = p.useState(0);
|
|
1156
|
+
return p.useEffect(() => {
|
|
1157
|
+
const D = g.current;
|
|
1158
|
+
if (D)
|
|
1159
|
+
return D.addEventListener(qe, w), () => D.removeEventListener(qe, w);
|
|
1160
|
+
}, [w]), /* @__PURE__ */ l(
|
|
1161
|
+
Yr,
|
|
1162
|
+
{
|
|
1163
|
+
scope: o,
|
|
1164
|
+
orientation: r,
|
|
1165
|
+
dir: N,
|
|
1166
|
+
loop: n,
|
|
1167
|
+
currentTabStopId: v,
|
|
1168
|
+
onItemFocus: p.useCallback(
|
|
1169
|
+
(D) => b(D),
|
|
1170
|
+
[b]
|
|
1171
|
+
),
|
|
1172
|
+
onItemShiftTab: p.useCallback(() => S(!0), []),
|
|
1173
|
+
onFocusableItemAdd: p.useCallback(
|
|
1174
|
+
() => k((D) => D + 1),
|
|
1175
|
+
[]
|
|
1176
|
+
),
|
|
1177
|
+
onFocusableItemRemove: p.useCallback(
|
|
1178
|
+
() => k((D) => D - 1),
|
|
1179
|
+
[]
|
|
1180
|
+
),
|
|
1181
|
+
children: /* @__PURE__ */ l(
|
|
1182
|
+
te.div,
|
|
1183
|
+
{
|
|
1184
|
+
tabIndex: C || R === 0 ? -1 : 0,
|
|
1185
|
+
"data-orientation": r,
|
|
1186
|
+
...h,
|
|
1187
|
+
ref: a,
|
|
1188
|
+
style: { outline: "none", ...e.style },
|
|
1189
|
+
onMouseDown: W(e.onMouseDown, () => {
|
|
1190
|
+
z.current = !0;
|
|
1191
|
+
}),
|
|
1192
|
+
onFocus: W(e.onFocus, (D) => {
|
|
1193
|
+
const P = !z.current;
|
|
1194
|
+
if (D.target === D.currentTarget && P && !C) {
|
|
1195
|
+
const M = new CustomEvent(qe, jr);
|
|
1196
|
+
if (D.currentTarget.dispatchEvent(M), !M.defaultPrevented) {
|
|
1197
|
+
const F = T().filter((H) => H.focusable), E = F.find((H) => H.active), ue = F.find((H) => H.id === v), ne = [E, ue, ...F].filter(
|
|
1198
|
+
Boolean
|
|
1199
|
+
).map((H) => H.ref.current);
|
|
1200
|
+
fo(ne, f);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
z.current = !1;
|
|
1204
|
+
}),
|
|
1205
|
+
onBlur: W(e.onBlur, () => S(!1))
|
|
1206
|
+
}
|
|
1207
|
+
)
|
|
1208
|
+
}
|
|
1209
|
+
);
|
|
1210
|
+
}), co = "RovingFocusGroupItem", uo = p.forwardRef(
|
|
1211
|
+
(e, t) => {
|
|
1212
|
+
const {
|
|
1213
|
+
__scopeRovingFocusGroup: o,
|
|
1214
|
+
focusable: r = !0,
|
|
1215
|
+
active: n = !1,
|
|
1216
|
+
tabStopId: s,
|
|
1217
|
+
children: i,
|
|
1218
|
+
...c
|
|
1219
|
+
} = e, d = Ko(), u = s || d, f = Ur(co, o), h = f.currentTabStopId === u, g = so(o), { onFocusableItemAdd: a, onFocusableItemRemove: N, currentTabStopId: v } = f;
|
|
1220
|
+
return p.useEffect(() => {
|
|
1221
|
+
if (r)
|
|
1222
|
+
return a(), () => N();
|
|
1223
|
+
}, [r, a, N]), /* @__PURE__ */ l(
|
|
1224
|
+
Qe.ItemSlot,
|
|
1225
|
+
{
|
|
1226
|
+
scope: o,
|
|
1227
|
+
id: u,
|
|
1228
|
+
focusable: r,
|
|
1229
|
+
active: n,
|
|
1230
|
+
children: /* @__PURE__ */ l(
|
|
1231
|
+
te.span,
|
|
1232
|
+
{
|
|
1233
|
+
tabIndex: h ? 0 : -1,
|
|
1234
|
+
"data-orientation": f.orientation,
|
|
1235
|
+
...c,
|
|
1236
|
+
ref: t,
|
|
1237
|
+
onMouseDown: W(e.onMouseDown, (b) => {
|
|
1238
|
+
r ? f.onItemFocus(u) : b.preventDefault();
|
|
1239
|
+
}),
|
|
1240
|
+
onFocus: W(e.onFocus, () => f.onItemFocus(u)),
|
|
1241
|
+
onKeyDown: W(e.onKeyDown, (b) => {
|
|
1242
|
+
if (b.key === "Tab" && b.shiftKey) {
|
|
1243
|
+
f.onItemShiftTab();
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
if (b.target !== b.currentTarget) return;
|
|
1247
|
+
const C = Qr(b, f.orientation, f.dir);
|
|
1248
|
+
if (C !== void 0) {
|
|
1249
|
+
if (b.metaKey || b.ctrlKey || b.altKey || b.shiftKey) return;
|
|
1250
|
+
b.preventDefault();
|
|
1251
|
+
let w = g().filter((T) => T.focusable).map((T) => T.ref.current);
|
|
1252
|
+
if (C === "last") w.reverse();
|
|
1253
|
+
else if (C === "prev" || C === "next") {
|
|
1254
|
+
C === "prev" && w.reverse();
|
|
1255
|
+
const T = w.indexOf(b.currentTarget);
|
|
1256
|
+
w = f.loop ? Zr(w, T + 1) : w.slice(T + 1);
|
|
1257
|
+
}
|
|
1258
|
+
setTimeout(() => fo(w));
|
|
1259
|
+
}
|
|
1260
|
+
}),
|
|
1261
|
+
children: typeof i == "function" ? i({ isCurrentTabStop: h, hasTabStop: v != null }) : i
|
|
1262
|
+
}
|
|
1263
|
+
)
|
|
1264
|
+
}
|
|
1265
|
+
);
|
|
1266
|
+
}
|
|
1267
|
+
);
|
|
1268
|
+
uo.displayName = co;
|
|
1269
|
+
var Kr = {
|
|
1270
|
+
ArrowLeft: "prev",
|
|
1271
|
+
ArrowUp: "prev",
|
|
1272
|
+
ArrowRight: "next",
|
|
1273
|
+
ArrowDown: "next",
|
|
1274
|
+
PageUp: "first",
|
|
1275
|
+
Home: "first",
|
|
1276
|
+
PageDown: "last",
|
|
1277
|
+
End: "last"
|
|
1278
|
+
};
|
|
1279
|
+
function qr(e, t) {
|
|
1280
|
+
return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
1281
|
+
}
|
|
1282
|
+
function Qr(e, t, o) {
|
|
1283
|
+
const r = qr(e.key, o);
|
|
1284
|
+
if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r)))
|
|
1285
|
+
return Kr[r];
|
|
1286
|
+
}
|
|
1287
|
+
function fo(e, t = !1) {
|
|
1288
|
+
const o = document.activeElement;
|
|
1289
|
+
for (const r of e)
|
|
1290
|
+
if (r === o || (r.focus({ preventScroll: t }), document.activeElement !== o)) return;
|
|
1291
|
+
}
|
|
1292
|
+
function Zr(e, t) {
|
|
1293
|
+
return e.map((o, r) => e[(t + r) % e.length]);
|
|
1294
|
+
}
|
|
1295
|
+
var Jr = io, en = uo, mo = "Toggle", it = p.forwardRef((e, t) => {
|
|
1296
|
+
const { pressed: o, defaultPressed: r, onPressedChange: n, ...s } = e, [i, c] = Oe({
|
|
1297
|
+
prop: o,
|
|
1298
|
+
onChange: n,
|
|
1299
|
+
defaultProp: r ?? !1,
|
|
1300
|
+
caller: mo
|
|
1301
|
+
});
|
|
1302
|
+
return /* @__PURE__ */ l(
|
|
1303
|
+
te.button,
|
|
1304
|
+
{
|
|
1305
|
+
type: "button",
|
|
1306
|
+
"aria-pressed": i,
|
|
1307
|
+
"data-state": i ? "on" : "off",
|
|
1308
|
+
"data-disabled": e.disabled ? "" : void 0,
|
|
1309
|
+
...s,
|
|
1310
|
+
ref: t,
|
|
1311
|
+
onClick: W(e.onClick, () => {
|
|
1312
|
+
e.disabled || c(!i);
|
|
1313
|
+
})
|
|
1314
|
+
}
|
|
1315
|
+
);
|
|
1316
|
+
});
|
|
1317
|
+
it.displayName = mo;
|
|
1318
|
+
var po = it, de = "ToggleGroup", [ho] = ze(de, [
|
|
1319
|
+
lo
|
|
1320
|
+
]), go = lo(), ct = m.forwardRef((e, t) => {
|
|
1321
|
+
const { type: o, ...r } = e;
|
|
1322
|
+
if (o === "single")
|
|
1323
|
+
return /* @__PURE__ */ l(tn, { ...r, ref: t });
|
|
1324
|
+
if (o === "multiple")
|
|
1325
|
+
return /* @__PURE__ */ l(on, { ...r, ref: t });
|
|
1326
|
+
throw new Error(`Missing prop \`type\` expected on \`${de}\``);
|
|
1327
|
+
});
|
|
1328
|
+
ct.displayName = de;
|
|
1329
|
+
var [vo, bo] = ho(de), tn = m.forwardRef((e, t) => {
|
|
1330
|
+
const {
|
|
1331
|
+
value: o,
|
|
1332
|
+
defaultValue: r,
|
|
1333
|
+
onValueChange: n = () => {
|
|
1334
|
+
},
|
|
1335
|
+
...s
|
|
1336
|
+
} = e, [i, c] = Oe({
|
|
1337
|
+
prop: o,
|
|
1338
|
+
defaultProp: r ?? "",
|
|
1339
|
+
onChange: n,
|
|
1340
|
+
caller: de
|
|
1341
|
+
});
|
|
1342
|
+
return /* @__PURE__ */ l(
|
|
1343
|
+
vo,
|
|
1344
|
+
{
|
|
1345
|
+
scope: e.__scopeToggleGroup,
|
|
1346
|
+
type: "single",
|
|
1347
|
+
value: m.useMemo(() => i ? [i] : [], [i]),
|
|
1348
|
+
onItemActivate: c,
|
|
1349
|
+
onItemDeactivate: m.useCallback(() => c(""), [c]),
|
|
1350
|
+
children: /* @__PURE__ */ l(yo, { ...s, ref: t })
|
|
1351
|
+
}
|
|
1352
|
+
);
|
|
1353
|
+
}), on = m.forwardRef((e, t) => {
|
|
1354
|
+
const {
|
|
1355
|
+
value: o,
|
|
1356
|
+
defaultValue: r,
|
|
1357
|
+
onValueChange: n = () => {
|
|
1358
|
+
},
|
|
1359
|
+
...s
|
|
1360
|
+
} = e, [i, c] = Oe({
|
|
1361
|
+
prop: o,
|
|
1362
|
+
defaultProp: r ?? [],
|
|
1363
|
+
onChange: n,
|
|
1364
|
+
caller: de
|
|
1365
|
+
}), d = m.useCallback(
|
|
1366
|
+
(f) => c((h = []) => [...h, f]),
|
|
1367
|
+
[c]
|
|
1368
|
+
), u = m.useCallback(
|
|
1369
|
+
(f) => c((h = []) => h.filter((g) => g !== f)),
|
|
1370
|
+
[c]
|
|
1371
|
+
);
|
|
1372
|
+
return /* @__PURE__ */ l(
|
|
1373
|
+
vo,
|
|
1374
|
+
{
|
|
1375
|
+
scope: e.__scopeToggleGroup,
|
|
1376
|
+
type: "multiple",
|
|
1377
|
+
value: i,
|
|
1378
|
+
onItemActivate: d,
|
|
1379
|
+
onItemDeactivate: u,
|
|
1380
|
+
children: /* @__PURE__ */ l(yo, { ...s, ref: t })
|
|
1381
|
+
}
|
|
1382
|
+
);
|
|
1383
|
+
});
|
|
1384
|
+
ct.displayName = de;
|
|
1385
|
+
var [rn, nn] = ho(de), yo = m.forwardRef(
|
|
1386
|
+
(e, t) => {
|
|
1387
|
+
const {
|
|
1388
|
+
__scopeToggleGroup: o,
|
|
1389
|
+
disabled: r = !1,
|
|
1390
|
+
rovingFocus: n = !0,
|
|
1391
|
+
orientation: s,
|
|
1392
|
+
dir: i,
|
|
1393
|
+
loop: c = !0,
|
|
1394
|
+
...d
|
|
1395
|
+
} = e, u = go(o), f = ot(i), h = { role: "group", dir: f, ...d };
|
|
1396
|
+
return /* @__PURE__ */ l(rn, { scope: o, rovingFocus: n, disabled: r, children: n ? /* @__PURE__ */ l(
|
|
1397
|
+
Jr,
|
|
1398
|
+
{
|
|
1399
|
+
asChild: !0,
|
|
1400
|
+
...u,
|
|
1401
|
+
orientation: s,
|
|
1402
|
+
dir: f,
|
|
1403
|
+
loop: c,
|
|
1404
|
+
children: /* @__PURE__ */ l(te.div, { ...h, ref: t })
|
|
1405
|
+
}
|
|
1406
|
+
) : /* @__PURE__ */ l(te.div, { ...h, ref: t }) });
|
|
1407
|
+
}
|
|
1408
|
+
), Le = "ToggleGroupItem", wo = m.forwardRef(
|
|
1409
|
+
(e, t) => {
|
|
1410
|
+
const o = bo(Le, e.__scopeToggleGroup), r = nn(Le, e.__scopeToggleGroup), n = go(e.__scopeToggleGroup), s = o.value.includes(e.value), i = r.disabled || e.disabled, c = { ...e, pressed: s, disabled: i }, d = m.useRef(null);
|
|
1411
|
+
return r.rovingFocus ? /* @__PURE__ */ l(
|
|
1412
|
+
en,
|
|
1413
|
+
{
|
|
1414
|
+
asChild: !0,
|
|
1415
|
+
...n,
|
|
1416
|
+
focusable: !i,
|
|
1417
|
+
active: s,
|
|
1418
|
+
ref: d,
|
|
1419
|
+
children: /* @__PURE__ */ l(xt, { ...c, ref: t })
|
|
1420
|
+
}
|
|
1421
|
+
) : /* @__PURE__ */ l(xt, { ...c, ref: t });
|
|
1422
|
+
}
|
|
1423
|
+
);
|
|
1424
|
+
wo.displayName = Le;
|
|
1425
|
+
var xt = m.forwardRef(
|
|
1426
|
+
(e, t) => {
|
|
1427
|
+
const { __scopeToggleGroup: o, value: r, ...n } = e, s = bo(Le, o), i = { role: "radio", "aria-checked": e.pressed, "aria-pressed": void 0 }, c = s.type === "single" ? i : void 0;
|
|
1428
|
+
return /* @__PURE__ */ l(
|
|
1429
|
+
it,
|
|
1430
|
+
{
|
|
1431
|
+
...c,
|
|
1432
|
+
...n,
|
|
1433
|
+
ref: t,
|
|
1434
|
+
onPressedChange: (d) => {
|
|
1435
|
+
d ? s.onItemActivate(r) : s.onItemDeactivate(r);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
);
|
|
1439
|
+
}
|
|
1440
|
+
), xo = ct, So = wo;
|
|
1441
|
+
const Co = qo(
|
|
1442
|
+
"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
|
|
1443
|
+
{
|
|
1444
|
+
variants: {
|
|
1445
|
+
variant: {
|
|
1446
|
+
default: "bg-transparent",
|
|
1447
|
+
outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"
|
|
1448
|
+
},
|
|
1449
|
+
size: {
|
|
1450
|
+
default: "h-10 px-3",
|
|
1451
|
+
sm: "h-9 px-2.5",
|
|
1452
|
+
lg: "h-11 px-5"
|
|
1453
|
+
}
|
|
1454
|
+
},
|
|
1455
|
+
defaultVariants: {
|
|
1456
|
+
variant: "default",
|
|
1457
|
+
size: "default"
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
), an = p.forwardRef(({ className: e, variant: t, size: o, ...r }, n) => /* @__PURE__ */ l(po, { ref: n, className: Te(Co({ variant: t, size: o, className: e })), ...r }));
|
|
1461
|
+
an.displayName = po.displayName;
|
|
1462
|
+
const Eo = p.createContext({
|
|
1463
|
+
size: "default",
|
|
1464
|
+
variant: "default"
|
|
1465
|
+
}), No = p.forwardRef(({ className: e, variant: t, size: o, children: r, ...n }, s) => /* @__PURE__ */ l(xo, { ref: s, className: Te("flex items-center justify-center gap-1", e), ...n, children: /* @__PURE__ */ l(Eo.Provider, { value: { variant: t, size: o }, children: r }) }));
|
|
1466
|
+
No.displayName = xo.displayName;
|
|
1467
|
+
const To = p.forwardRef(({ className: e, children: t, variant: o, size: r, ...n }, s) => {
|
|
1468
|
+
const i = p.useContext(Eo);
|
|
1469
|
+
return /* @__PURE__ */ l(
|
|
1470
|
+
So,
|
|
1471
|
+
{
|
|
1472
|
+
ref: s,
|
|
1473
|
+
className: Te(
|
|
1474
|
+
Co({
|
|
1475
|
+
variant: i.variant || o,
|
|
1476
|
+
size: i.size || r
|
|
1477
|
+
}),
|
|
1478
|
+
e
|
|
1479
|
+
),
|
|
1480
|
+
...n,
|
|
1481
|
+
children: t
|
|
1482
|
+
}
|
|
1483
|
+
);
|
|
1484
|
+
});
|
|
1485
|
+
To.displayName = So.displayName;
|
|
1486
|
+
var sn = (e) => {
|
|
1487
|
+
switch (e) {
|
|
1488
|
+
case "success":
|
|
1489
|
+
return dn;
|
|
1490
|
+
case "info":
|
|
1491
|
+
return fn;
|
|
1492
|
+
case "warning":
|
|
1493
|
+
return un;
|
|
1494
|
+
case "error":
|
|
1495
|
+
return mn;
|
|
1496
|
+
default:
|
|
1497
|
+
return null;
|
|
1498
|
+
}
|
|
1499
|
+
}, ln = Array(12).fill(0), cn = ({ visible: e, className: t }) => m.createElement("div", { className: ["sonner-loading-wrapper", t].filter(Boolean).join(" "), "data-visible": e }, m.createElement("div", { className: "sonner-spinner" }, ln.map((o, r) => m.createElement("div", { className: "sonner-loading-bar", key: `spinner-bar-${r}` })))), dn = m.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, m.createElement("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z", clipRule: "evenodd" })), un = m.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", height: "20", width: "20" }, m.createElement("path", { fillRule: "evenodd", d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z", clipRule: "evenodd" })), fn = m.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, m.createElement("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 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z", clipRule: "evenodd" })), mn = m.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, m.createElement("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z", clipRule: "evenodd" })), pn = m.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }, m.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), m.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })), hn = () => {
|
|
1500
|
+
let [e, t] = m.useState(document.hidden);
|
|
1501
|
+
return m.useEffect(() => {
|
|
1502
|
+
let o = () => {
|
|
1503
|
+
t(document.hidden);
|
|
1504
|
+
};
|
|
1505
|
+
return document.addEventListener("visibilitychange", o), () => window.removeEventListener("visibilitychange", o);
|
|
1506
|
+
}, []), e;
|
|
1507
|
+
}, Ze = 1, gn = class {
|
|
1508
|
+
constructor() {
|
|
1509
|
+
this.subscribe = (e) => (this.subscribers.push(e), () => {
|
|
1510
|
+
let t = this.subscribers.indexOf(e);
|
|
1511
|
+
this.subscribers.splice(t, 1);
|
|
1512
|
+
}), this.publish = (e) => {
|
|
1513
|
+
this.subscribers.forEach((t) => t(e));
|
|
1514
|
+
}, this.addToast = (e) => {
|
|
1515
|
+
this.publish(e), this.toasts = [...this.toasts, e];
|
|
1516
|
+
}, this.create = (e) => {
|
|
1517
|
+
var t;
|
|
1518
|
+
let { message: o, ...r } = e, n = typeof (e == null ? void 0 : e.id) == "number" || ((t = e.id) == null ? void 0 : t.length) > 0 ? e.id : Ze++, s = this.toasts.find((c) => c.id === n), i = e.dismissible === void 0 ? !0 : e.dismissible;
|
|
1519
|
+
return this.dismissedToasts.has(n) && this.dismissedToasts.delete(n), s ? this.toasts = this.toasts.map((c) => c.id === n ? (this.publish({ ...c, ...e, id: n, title: o }), { ...c, ...e, id: n, dismissible: i, title: o }) : c) : this.addToast({ title: o, ...r, dismissible: i, id: n }), n;
|
|
1520
|
+
}, this.dismiss = (e) => (this.dismissedToasts.add(e), e || this.toasts.forEach((t) => {
|
|
1521
|
+
this.subscribers.forEach((o) => o({ id: t.id, dismiss: !0 }));
|
|
1522
|
+
}), this.subscribers.forEach((t) => t({ id: e, dismiss: !0 })), e), this.message = (e, t) => this.create({ ...t, message: e }), this.error = (e, t) => this.create({ ...t, message: e, type: "error" }), this.success = (e, t) => this.create({ ...t, type: "success", message: e }), this.info = (e, t) => this.create({ ...t, type: "info", message: e }), this.warning = (e, t) => this.create({ ...t, type: "warning", message: e }), this.loading = (e, t) => this.create({ ...t, type: "loading", message: e }), this.promise = (e, t) => {
|
|
1523
|
+
if (!t) return;
|
|
1524
|
+
let o;
|
|
1525
|
+
t.loading !== void 0 && (o = this.create({ ...t, promise: e, type: "loading", message: t.loading, description: typeof t.description != "function" ? t.description : void 0 }));
|
|
1526
|
+
let r = e instanceof Promise ? e : e(), n = o !== void 0, s, i = r.then(async (d) => {
|
|
1527
|
+
if (s = ["resolve", d], m.isValidElement(d)) n = !1, this.create({ id: o, type: "default", message: d });
|
|
1528
|
+
else if (bn(d) && !d.ok) {
|
|
1529
|
+
n = !1;
|
|
1530
|
+
let u = typeof t.error == "function" ? await t.error(`HTTP error! status: ${d.status}`) : t.error, f = typeof t.description == "function" ? await t.description(`HTTP error! status: ${d.status}`) : t.description;
|
|
1531
|
+
this.create({ id: o, type: "error", message: u, description: f });
|
|
1532
|
+
} else if (t.success !== void 0) {
|
|
1533
|
+
n = !1;
|
|
1534
|
+
let u = typeof t.success == "function" ? await t.success(d) : t.success, f = typeof t.description == "function" ? await t.description(d) : t.description;
|
|
1535
|
+
this.create({ id: o, type: "success", message: u, description: f });
|
|
1536
|
+
}
|
|
1537
|
+
}).catch(async (d) => {
|
|
1538
|
+
if (s = ["reject", d], t.error !== void 0) {
|
|
1539
|
+
n = !1;
|
|
1540
|
+
let u = typeof t.error == "function" ? await t.error(d) : t.error, f = typeof t.description == "function" ? await t.description(d) : t.description;
|
|
1541
|
+
this.create({ id: o, type: "error", message: u, description: f });
|
|
1542
|
+
}
|
|
1543
|
+
}).finally(() => {
|
|
1544
|
+
var d;
|
|
1545
|
+
n && (this.dismiss(o), o = void 0), (d = t.finally) == null || d.call(t);
|
|
1546
|
+
}), c = () => new Promise((d, u) => i.then(() => s[0] === "reject" ? u(s[1]) : d(s[1])).catch(u));
|
|
1547
|
+
return typeof o != "string" && typeof o != "number" ? { unwrap: c } : Object.assign(o, { unwrap: c });
|
|
1548
|
+
}, this.custom = (e, t) => {
|
|
1549
|
+
let o = (t == null ? void 0 : t.id) || Ze++;
|
|
1550
|
+
return this.create({ jsx: e(o), id: o, ...t }), o;
|
|
1551
|
+
}, this.getActiveToasts = () => this.toasts.filter((e) => !this.dismissedToasts.has(e.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
|
|
1552
|
+
}
|
|
1553
|
+
}, G = new gn(), vn = (e, t) => {
|
|
1554
|
+
let o = (t == null ? void 0 : t.id) || Ze++;
|
|
1555
|
+
return G.addToast({ title: e, ...t, id: o }), o;
|
|
1556
|
+
}, bn = (e) => e && typeof e == "object" && "ok" in e && typeof e.ok == "boolean" && "status" in e && typeof e.status == "number", yn = vn, wn = () => G.toasts, xn = () => G.getActiveToasts(), Sn = Object.assign(yn, { success: G.success, info: G.info, warning: G.warning, error: G.error, custom: G.custom, message: G.message, promise: G.promise, dismiss: G.dismiss, loading: G.loading }, { getHistory: wn, getToasts: xn });
|
|
1557
|
+
function Cn(e, { insertAt: t } = {}) {
|
|
1558
|
+
if (typeof document > "u") return;
|
|
1559
|
+
let o = document.head || document.getElementsByTagName("head")[0], r = document.createElement("style");
|
|
1560
|
+
r.type = "text/css", t === "top" && o.firstChild ? o.insertBefore(r, o.firstChild) : o.appendChild(r), r.styleSheet ? r.styleSheet.cssText = e : r.appendChild(document.createTextNode(e));
|
|
1561
|
+
}
|
|
1562
|
+
Cn(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
1563
|
+
`);
|
|
1564
|
+
function Ie(e) {
|
|
1565
|
+
return e.label !== void 0;
|
|
1566
|
+
}
|
|
1567
|
+
var En = 3, Nn = "32px", Tn = "16px", St = 4e3, Rn = 356, Pn = 14, kn = 20, In = 200;
|
|
1568
|
+
function ee(...e) {
|
|
1569
|
+
return e.filter(Boolean).join(" ");
|
|
1570
|
+
}
|
|
1571
|
+
function Dn(e) {
|
|
1572
|
+
let [t, o] = e.split("-"), r = [];
|
|
1573
|
+
return t && r.push(t), o && r.push(o), r;
|
|
1574
|
+
}
|
|
1575
|
+
var An = (e) => {
|
|
1576
|
+
var t, o, r, n, s, i, c, d, u, f, h;
|
|
1577
|
+
let { invert: g, toast: a, unstyled: N, interacting: v, setHeights: b, visibleToasts: C, heights: S, index: w, toasts: T, expanded: z, removeToast: R, defaultRichColors: k, closeButton: D, style: P, cancelButtonStyle: M, actionButtonStyle: F, className: E = "", descriptionClassName: ue = "", duration: V, position: ne, gap: H, loadingIcon: q, expandByDefault: fe, classNames: x, icons: U, closeButtonAriaLabel: He = "Close toast", pauseWhenPageIsHidden: A } = e, [_, $] = m.useState(null), [j, he] = m.useState(null), [O, Ve] = m.useState(!1), [Se, Pe] = m.useState(!1), [Ce, je] = m.useState(!1), [ut, ko] = m.useState(!1), [Io, ft] = m.useState(!1), [Do, Ge] = m.useState(0), [Ao, mt] = m.useState(0), Ee = m.useRef(a.duration || V || St), pt = m.useRef(null), me = m.useRef(null), Mo = w === 0, _o = w + 1 <= C, X = a.type, ge = a.dismissible !== !1, Lo = a.className || "", zo = a.descriptionClassName || "", ke = m.useMemo(() => S.findIndex((y) => y.toastId === a.id) || 0, [S, a.id]), $o = m.useMemo(() => {
|
|
1578
|
+
var y;
|
|
1579
|
+
return (y = a.closeButton) != null ? y : D;
|
|
1580
|
+
}, [a.closeButton, D]), ht = m.useMemo(() => a.duration || V || St, [a.duration, V]), We = m.useRef(0), ve = m.useRef(0), gt = m.useRef(0), be = m.useRef(null), [Oo, Bo] = ne.split("-"), vt = m.useMemo(() => S.reduce((y, I, L) => L >= ke ? y : y + I.height, 0), [S, ke]), bt = hn(), Fo = a.invert || g, Ye = X === "loading";
|
|
1581
|
+
ve.current = m.useMemo(() => ke * H + vt, [ke, vt]), m.useEffect(() => {
|
|
1582
|
+
Ee.current = ht;
|
|
1583
|
+
}, [ht]), m.useEffect(() => {
|
|
1584
|
+
Ve(!0);
|
|
1585
|
+
}, []), m.useEffect(() => {
|
|
1586
|
+
let y = me.current;
|
|
1587
|
+
if (y) {
|
|
1588
|
+
let I = y.getBoundingClientRect().height;
|
|
1589
|
+
return mt(I), b((L) => [{ toastId: a.id, height: I, position: a.position }, ...L]), () => b((L) => L.filter((Q) => Q.toastId !== a.id));
|
|
1590
|
+
}
|
|
1591
|
+
}, [b, a.id]), m.useLayoutEffect(() => {
|
|
1592
|
+
if (!O) return;
|
|
1593
|
+
let y = me.current, I = y.style.height;
|
|
1594
|
+
y.style.height = "auto";
|
|
1595
|
+
let L = y.getBoundingClientRect().height;
|
|
1596
|
+
y.style.height = I, mt(L), b((Q) => Q.find((Z) => Z.toastId === a.id) ? Q.map((Z) => Z.toastId === a.id ? { ...Z, height: L } : Z) : [{ toastId: a.id, height: L, position: a.position }, ...Q]);
|
|
1597
|
+
}, [O, a.title, a.description, b, a.id]);
|
|
1598
|
+
let ae = m.useCallback(() => {
|
|
1599
|
+
Pe(!0), Ge(ve.current), b((y) => y.filter((I) => I.toastId !== a.id)), setTimeout(() => {
|
|
1600
|
+
R(a);
|
|
1601
|
+
}, In);
|
|
1602
|
+
}, [a, R, b, ve]);
|
|
1603
|
+
m.useEffect(() => {
|
|
1604
|
+
if (a.promise && X === "loading" || a.duration === 1 / 0 || a.type === "loading") return;
|
|
1605
|
+
let y;
|
|
1606
|
+
return z || v || A && bt ? (() => {
|
|
1607
|
+
if (gt.current < We.current) {
|
|
1608
|
+
let I = (/* @__PURE__ */ new Date()).getTime() - We.current;
|
|
1609
|
+
Ee.current = Ee.current - I;
|
|
1610
|
+
}
|
|
1611
|
+
gt.current = (/* @__PURE__ */ new Date()).getTime();
|
|
1612
|
+
})() : Ee.current !== 1 / 0 && (We.current = (/* @__PURE__ */ new Date()).getTime(), y = setTimeout(() => {
|
|
1613
|
+
var I;
|
|
1614
|
+
(I = a.onAutoClose) == null || I.call(a, a), ae();
|
|
1615
|
+
}, Ee.current)), () => clearTimeout(y);
|
|
1616
|
+
}, [z, v, a, X, A, bt, ae]), m.useEffect(() => {
|
|
1617
|
+
a.delete && ae();
|
|
1618
|
+
}, [ae, a.delete]);
|
|
1619
|
+
function Ho() {
|
|
1620
|
+
var y, I, L;
|
|
1621
|
+
return U != null && U.loading ? m.createElement("div", { className: ee(x == null ? void 0 : x.loader, (y = a == null ? void 0 : a.classNames) == null ? void 0 : y.loader, "sonner-loader"), "data-visible": X === "loading" }, U.loading) : q ? m.createElement("div", { className: ee(x == null ? void 0 : x.loader, (I = a == null ? void 0 : a.classNames) == null ? void 0 : I.loader, "sonner-loader"), "data-visible": X === "loading" }, q) : m.createElement(cn, { className: ee(x == null ? void 0 : x.loader, (L = a == null ? void 0 : a.classNames) == null ? void 0 : L.loader), visible: X === "loading" });
|
|
1622
|
+
}
|
|
1623
|
+
return m.createElement("li", { tabIndex: 0, ref: me, className: ee(E, Lo, x == null ? void 0 : x.toast, (t = a == null ? void 0 : a.classNames) == null ? void 0 : t.toast, x == null ? void 0 : x.default, x == null ? void 0 : x[X], (o = a == null ? void 0 : a.classNames) == null ? void 0 : o[X]), "data-sonner-toast": "", "data-rich-colors": (r = a.richColors) != null ? r : k, "data-styled": !(a.jsx || a.unstyled || N), "data-mounted": O, "data-promise": !!a.promise, "data-swiped": Io, "data-removed": Se, "data-visible": _o, "data-y-position": Oo, "data-x-position": Bo, "data-index": w, "data-front": Mo, "data-swiping": Ce, "data-dismissible": ge, "data-type": X, "data-invert": Fo, "data-swipe-out": ut, "data-swipe-direction": j, "data-expanded": !!(z || fe && O), style: { "--index": w, "--toasts-before": w, "--z-index": T.length - w, "--offset": `${Se ? Do : ve.current}px`, "--initial-height": fe ? "auto" : `${Ao}px`, ...P, ...a.style }, onDragEnd: () => {
|
|
1624
|
+
je(!1), $(null), be.current = null;
|
|
1625
|
+
}, onPointerDown: (y) => {
|
|
1626
|
+
Ye || !ge || (pt.current = /* @__PURE__ */ new Date(), Ge(ve.current), y.target.setPointerCapture(y.pointerId), y.target.tagName !== "BUTTON" && (je(!0), be.current = { x: y.clientX, y: y.clientY }));
|
|
1627
|
+
}, onPointerUp: () => {
|
|
1628
|
+
var y, I, L, Q;
|
|
1629
|
+
if (ut || !ge) return;
|
|
1630
|
+
be.current = null;
|
|
1631
|
+
let Z = Number(((y = me.current) == null ? void 0 : y.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), se = Number(((I = me.current) == null ? void 0 : I.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), pe = (/* @__PURE__ */ new Date()).getTime() - ((L = pt.current) == null ? void 0 : L.getTime()), J = _ === "x" ? Z : se, le = Math.abs(J) / pe;
|
|
1632
|
+
if (Math.abs(J) >= kn || le > 0.11) {
|
|
1633
|
+
Ge(ve.current), (Q = a.onDismiss) == null || Q.call(a, a), he(_ === "x" ? Z > 0 ? "right" : "left" : se > 0 ? "down" : "up"), ae(), ko(!0), ft(!1);
|
|
1634
|
+
return;
|
|
1635
|
+
}
|
|
1636
|
+
je(!1), $(null);
|
|
1637
|
+
}, onPointerMove: (y) => {
|
|
1638
|
+
var I, L, Q, Z;
|
|
1639
|
+
if (!be.current || !ge || ((I = window.getSelection()) == null ? void 0 : I.toString().length) > 0) return;
|
|
1640
|
+
let se = y.clientY - be.current.y, pe = y.clientX - be.current.x, J = (L = e.swipeDirections) != null ? L : Dn(ne);
|
|
1641
|
+
!_ && (Math.abs(pe) > 1 || Math.abs(se) > 1) && $(Math.abs(pe) > Math.abs(se) ? "x" : "y");
|
|
1642
|
+
let le = { x: 0, y: 0 };
|
|
1643
|
+
_ === "y" ? (J.includes("top") || J.includes("bottom")) && (J.includes("top") && se < 0 || J.includes("bottom") && se > 0) && (le.y = se) : _ === "x" && (J.includes("left") || J.includes("right")) && (J.includes("left") && pe < 0 || J.includes("right") && pe > 0) && (le.x = pe), (Math.abs(le.x) > 0 || Math.abs(le.y) > 0) && ft(!0), (Q = me.current) == null || Q.style.setProperty("--swipe-amount-x", `${le.x}px`), (Z = me.current) == null || Z.style.setProperty("--swipe-amount-y", `${le.y}px`);
|
|
1644
|
+
} }, $o && !a.jsx ? m.createElement("button", { "aria-label": He, "data-disabled": Ye, "data-close-button": !0, onClick: Ye || !ge ? () => {
|
|
1645
|
+
} : () => {
|
|
1646
|
+
var y;
|
|
1647
|
+
ae(), (y = a.onDismiss) == null || y.call(a, a);
|
|
1648
|
+
}, className: ee(x == null ? void 0 : x.closeButton, (n = a == null ? void 0 : a.classNames) == null ? void 0 : n.closeButton) }, (s = U == null ? void 0 : U.close) != null ? s : pn) : null, a.jsx || Ue(a.title) ? a.jsx ? a.jsx : typeof a.title == "function" ? a.title() : a.title : m.createElement(m.Fragment, null, X || a.icon || a.promise ? m.createElement("div", { "data-icon": "", className: ee(x == null ? void 0 : x.icon, (i = a == null ? void 0 : a.classNames) == null ? void 0 : i.icon) }, a.promise || a.type === "loading" && !a.icon ? a.icon || Ho() : null, a.type !== "loading" ? a.icon || (U == null ? void 0 : U[X]) || sn(X) : null) : null, m.createElement("div", { "data-content": "", className: ee(x == null ? void 0 : x.content, (c = a == null ? void 0 : a.classNames) == null ? void 0 : c.content) }, m.createElement("div", { "data-title": "", className: ee(x == null ? void 0 : x.title, (d = a == null ? void 0 : a.classNames) == null ? void 0 : d.title) }, typeof a.title == "function" ? a.title() : a.title), a.description ? m.createElement("div", { "data-description": "", className: ee(ue, zo, x == null ? void 0 : x.description, (u = a == null ? void 0 : a.classNames) == null ? void 0 : u.description) }, typeof a.description == "function" ? a.description() : a.description) : null), Ue(a.cancel) ? a.cancel : a.cancel && Ie(a.cancel) ? m.createElement("button", { "data-button": !0, "data-cancel": !0, style: a.cancelButtonStyle || M, onClick: (y) => {
|
|
1649
|
+
var I, L;
|
|
1650
|
+
Ie(a.cancel) && ge && ((L = (I = a.cancel).onClick) == null || L.call(I, y), ae());
|
|
1651
|
+
}, className: ee(x == null ? void 0 : x.cancelButton, (f = a == null ? void 0 : a.classNames) == null ? void 0 : f.cancelButton) }, a.cancel.label) : null, Ue(a.action) ? a.action : a.action && Ie(a.action) ? m.createElement("button", { "data-button": !0, "data-action": !0, style: a.actionButtonStyle || F, onClick: (y) => {
|
|
1652
|
+
var I, L;
|
|
1653
|
+
Ie(a.action) && ((L = (I = a.action).onClick) == null || L.call(I, y), !y.defaultPrevented && ae());
|
|
1654
|
+
}, className: ee(x == null ? void 0 : x.actionButton, (h = a == null ? void 0 : a.classNames) == null ? void 0 : h.actionButton) }, a.action.label) : null));
|
|
1655
|
+
};
|
|
1656
|
+
function Ct() {
|
|
1657
|
+
if (typeof window > "u" || typeof document > "u") return "ltr";
|
|
1658
|
+
let e = document.documentElement.getAttribute("dir");
|
|
1659
|
+
return e === "auto" || !e ? window.getComputedStyle(document.documentElement).direction : e;
|
|
1660
|
+
}
|
|
1661
|
+
function Mn(e, t) {
|
|
1662
|
+
let o = {};
|
|
1663
|
+
return [e, t].forEach((r, n) => {
|
|
1664
|
+
let s = n === 1, i = s ? "--mobile-offset" : "--offset", c = s ? Tn : Nn;
|
|
1665
|
+
function d(u) {
|
|
1666
|
+
["top", "right", "bottom", "left"].forEach((f) => {
|
|
1667
|
+
o[`${i}-${f}`] = typeof u == "number" ? `${u}px` : u;
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
typeof r == "number" || typeof r == "string" ? d(r) : typeof r == "object" ? ["top", "right", "bottom", "left"].forEach((u) => {
|
|
1671
|
+
r[u] === void 0 ? o[`${i}-${u}`] = c : o[`${i}-${u}`] = typeof r[u] == "number" ? `${r[u]}px` : r[u];
|
|
1672
|
+
}) : d(c);
|
|
1673
|
+
}), o;
|
|
1674
|
+
}
|
|
1675
|
+
Vo(function(e, t) {
|
|
1676
|
+
let { invert: o, position: r = "bottom-right", hotkey: n = ["altKey", "KeyT"], expand: s, closeButton: i, className: c, offset: d, mobileOffset: u, theme: f = "light", richColors: h, duration: g, style: a, visibleToasts: N = En, toastOptions: v, dir: b = Ct(), gap: C = Pn, loadingIcon: S, icons: w, containerAriaLabel: T = "Notifications", pauseWhenPageIsHidden: z } = e, [R, k] = m.useState([]), D = m.useMemo(() => Array.from(new Set([r].concat(R.filter((A) => A.position).map((A) => A.position)))), [R, r]), [P, M] = m.useState([]), [F, E] = m.useState(!1), [ue, V] = m.useState(!1), [ne, H] = m.useState(f !== "system" ? f : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), q = m.useRef(null), fe = n.join("+").replace(/Key/g, "").replace(/Digit/g, ""), x = m.useRef(null), U = m.useRef(!1), He = m.useCallback((A) => {
|
|
1677
|
+
k((_) => {
|
|
1678
|
+
var $;
|
|
1679
|
+
return ($ = _.find((j) => j.id === A.id)) != null && $.delete || G.dismiss(A.id), _.filter(({ id: j }) => j !== A.id);
|
|
1680
|
+
});
|
|
1681
|
+
}, []);
|
|
1682
|
+
return m.useEffect(() => G.subscribe((A) => {
|
|
1683
|
+
if (A.dismiss) {
|
|
1684
|
+
k((_) => _.map(($) => $.id === A.id ? { ...$, delete: !0 } : $));
|
|
1685
|
+
return;
|
|
1686
|
+
}
|
|
1687
|
+
setTimeout(() => {
|
|
1688
|
+
ur.flushSync(() => {
|
|
1689
|
+
k((_) => {
|
|
1690
|
+
let $ = _.findIndex((j) => j.id === A.id);
|
|
1691
|
+
return $ !== -1 ? [..._.slice(0, $), { ..._[$], ...A }, ..._.slice($ + 1)] : [A, ..._];
|
|
1692
|
+
});
|
|
1693
|
+
});
|
|
1694
|
+
});
|
|
1695
|
+
}), []), m.useEffect(() => {
|
|
1696
|
+
if (f !== "system") {
|
|
1697
|
+
H(f);
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
if (f === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? H("dark") : H("light")), typeof window > "u") return;
|
|
1701
|
+
let A = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1702
|
+
try {
|
|
1703
|
+
A.addEventListener("change", ({ matches: _ }) => {
|
|
1704
|
+
H(_ ? "dark" : "light");
|
|
1705
|
+
});
|
|
1706
|
+
} catch {
|
|
1707
|
+
A.addListener(({ matches: $ }) => {
|
|
1708
|
+
try {
|
|
1709
|
+
H($ ? "dark" : "light");
|
|
1710
|
+
} catch (j) {
|
|
1711
|
+
console.error(j);
|
|
1712
|
+
}
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
}, [f]), m.useEffect(() => {
|
|
1716
|
+
R.length <= 1 && E(!1);
|
|
1717
|
+
}, [R]), m.useEffect(() => {
|
|
1718
|
+
let A = (_) => {
|
|
1719
|
+
var $, j;
|
|
1720
|
+
n.every((he) => _[he] || _.code === he) && (E(!0), ($ = q.current) == null || $.focus()), _.code === "Escape" && (document.activeElement === q.current || (j = q.current) != null && j.contains(document.activeElement)) && E(!1);
|
|
1721
|
+
};
|
|
1722
|
+
return document.addEventListener("keydown", A), () => document.removeEventListener("keydown", A);
|
|
1723
|
+
}, [n]), m.useEffect(() => {
|
|
1724
|
+
if (q.current) return () => {
|
|
1725
|
+
x.current && (x.current.focus({ preventScroll: !0 }), x.current = null, U.current = !1);
|
|
1726
|
+
};
|
|
1727
|
+
}, [q.current]), m.createElement("section", { ref: t, "aria-label": `${T} ${fe}`, tabIndex: -1, "aria-live": "polite", "aria-relevant": "additions text", "aria-atomic": "false", suppressHydrationWarning: !0 }, D.map((A, _) => {
|
|
1728
|
+
var $;
|
|
1729
|
+
let [j, he] = A.split("-");
|
|
1730
|
+
return R.length ? m.createElement("ol", { key: A, dir: b === "auto" ? Ct() : b, tabIndex: -1, ref: q, className: c, "data-sonner-toaster": !0, "data-theme": ne, "data-y-position": j, "data-lifted": F && R.length > 1 && !s, "data-x-position": he, style: { "--front-toast-height": `${(($ = P[0]) == null ? void 0 : $.height) || 0}px`, "--width": `${Rn}px`, "--gap": `${C}px`, ...a, ...Mn(d, u) }, onBlur: (O) => {
|
|
1731
|
+
U.current && !O.currentTarget.contains(O.relatedTarget) && (U.current = !1, x.current && (x.current.focus({ preventScroll: !0 }), x.current = null));
|
|
1732
|
+
}, onFocus: (O) => {
|
|
1733
|
+
O.target instanceof HTMLElement && O.target.dataset.dismissible === "false" || U.current || (U.current = !0, x.current = O.relatedTarget);
|
|
1734
|
+
}, onMouseEnter: () => E(!0), onMouseMove: () => E(!0), onMouseLeave: () => {
|
|
1735
|
+
ue || E(!1);
|
|
1736
|
+
}, onDragEnd: () => E(!1), onPointerDown: (O) => {
|
|
1737
|
+
O.target instanceof HTMLElement && O.target.dataset.dismissible === "false" || V(!0);
|
|
1738
|
+
}, onPointerUp: () => V(!1) }, R.filter((O) => !O.position && _ === 0 || O.position === A).map((O, Ve) => {
|
|
1739
|
+
var Se, Pe;
|
|
1740
|
+
return m.createElement(An, { key: O.id, icons: w, index: Ve, toast: O, defaultRichColors: h, duration: (Se = v == null ? void 0 : v.duration) != null ? Se : g, className: v == null ? void 0 : v.className, descriptionClassName: v == null ? void 0 : v.descriptionClassName, invert: o, visibleToasts: N, closeButton: (Pe = v == null ? void 0 : v.closeButton) != null ? Pe : i, interacting: ue, position: A, style: v == null ? void 0 : v.style, unstyled: v == null ? void 0 : v.unstyled, classNames: v == null ? void 0 : v.classNames, cancelButtonStyle: v == null ? void 0 : v.cancelButtonStyle, actionButtonStyle: v == null ? void 0 : v.actionButtonStyle, removeToast: He, toasts: R.filter((Ce) => Ce.position == O.position), heights: P.filter((Ce) => Ce.position == O.position), setHeights: M, expandByDefault: s, gap: C, loadingIcon: S, expanded: F, pauseWhenPageIsHidden: z, swipeDirections: e.swipeDirections });
|
|
1741
|
+
})) : null;
|
|
1742
|
+
}));
|
|
1743
|
+
});
|
|
1744
|
+
const Ro = {
|
|
1745
|
+
mobile: { width: 375, icon: er, label: "Mobile (375px)" },
|
|
1746
|
+
tablet: { width: 768, icon: Jo, label: "Tablet (768px)" },
|
|
1747
|
+
small: { width: 1024, icon: Zo, label: "Small Desktop (1024px)" },
|
|
1748
|
+
desktop: { width: "100%", icon: Qo, label: "Desktop (Full)" }
|
|
1749
|
+
}, _n = ({ onSave: e, deviceSize: t, onDeviceSizeChange: o }) => {
|
|
1750
|
+
const { actions: r, query: n, canUndo: s, canRedo: i } = xe((d, u) => ({
|
|
1751
|
+
canUndo: u.history.canUndo(),
|
|
1752
|
+
canRedo: u.history.canRedo()
|
|
1753
|
+
})), c = () => {
|
|
1754
|
+
const d = n.serialize();
|
|
1755
|
+
e == null || e(d), Sn.success("Page saved successfully");
|
|
1756
|
+
};
|
|
1757
|
+
return /* @__PURE__ */ B("div", { className: "flex items-center gap-4", children: [
|
|
1758
|
+
/* @__PURE__ */ l(tr, { children: /* @__PURE__ */ l(
|
|
1759
|
+
No,
|
|
1760
|
+
{
|
|
1761
|
+
type: "single",
|
|
1762
|
+
value: t,
|
|
1763
|
+
onValueChange: (d) => d && o(d),
|
|
1764
|
+
className: "bg-muted rounded-md p-1",
|
|
1765
|
+
children: Object.entries(Ro).map(([d, { icon: u, label: f }]) => /* @__PURE__ */ B(or, { children: [
|
|
1766
|
+
/* @__PURE__ */ l(rr, { asChild: !0, children: /* @__PURE__ */ l(
|
|
1767
|
+
To,
|
|
1768
|
+
{
|
|
1769
|
+
value: d,
|
|
1770
|
+
size: "sm",
|
|
1771
|
+
className: "data-[state=on]:bg-background data-[state=on]:shadow-sm",
|
|
1772
|
+
children: /* @__PURE__ */ l(u, { className: "h-4 w-4" })
|
|
1773
|
+
}
|
|
1774
|
+
) }),
|
|
1775
|
+
/* @__PURE__ */ l(nr, { side: "bottom", children: /* @__PURE__ */ l("p", { children: f }) })
|
|
1776
|
+
] }, d))
|
|
1777
|
+
}
|
|
1778
|
+
) }),
|
|
1779
|
+
/* @__PURE__ */ l("div", { className: "h-6 w-px bg-border" }),
|
|
1780
|
+
/* @__PURE__ */ B("div", { className: "flex items-center gap-2", children: [
|
|
1781
|
+
/* @__PURE__ */ l(
|
|
1782
|
+
De,
|
|
1783
|
+
{
|
|
1784
|
+
variant: "outline",
|
|
1785
|
+
size: "sm",
|
|
1786
|
+
onClick: () => r.history.undo(),
|
|
1787
|
+
disabled: !s,
|
|
1788
|
+
children: /* @__PURE__ */ l(gr, { className: "h-4 w-4" })
|
|
1789
|
+
}
|
|
1790
|
+
),
|
|
1791
|
+
/* @__PURE__ */ l(
|
|
1792
|
+
De,
|
|
1793
|
+
{
|
|
1794
|
+
variant: "outline",
|
|
1795
|
+
size: "sm",
|
|
1796
|
+
onClick: () => r.history.redo(),
|
|
1797
|
+
disabled: !i,
|
|
1798
|
+
children: /* @__PURE__ */ l(mr, { className: "h-4 w-4" })
|
|
1799
|
+
}
|
|
1800
|
+
),
|
|
1801
|
+
/* @__PURE__ */ B(De, { size: "sm", onClick: c, children: [
|
|
1802
|
+
/* @__PURE__ */ l(pr, { className: "h-4 w-4 mr-2" }),
|
|
1803
|
+
"Save"
|
|
1804
|
+
] })
|
|
1805
|
+
] })
|
|
1806
|
+
] });
|
|
1807
|
+
}, dt = ({ children: e, className: t }) => {
|
|
1808
|
+
const {
|
|
1809
|
+
connectors: { connect: o, drag: r },
|
|
1810
|
+
selected: n
|
|
1811
|
+
} = Je((s) => ({
|
|
1812
|
+
selected: s.events.selected
|
|
1813
|
+
}));
|
|
1814
|
+
return /* @__PURE__ */ l(
|
|
1815
|
+
"div",
|
|
1816
|
+
{
|
|
1817
|
+
ref: (s) => {
|
|
1818
|
+
s && o(r(s));
|
|
1819
|
+
},
|
|
1820
|
+
className: Nt("relative min-h-[100vh] bg-white", t || ""),
|
|
1821
|
+
children: e
|
|
1822
|
+
}
|
|
1823
|
+
);
|
|
1824
|
+
};
|
|
1825
|
+
dt.craft = {
|
|
1826
|
+
props: {},
|
|
1827
|
+
displayName: "Body",
|
|
1828
|
+
isCanvas: !0,
|
|
1829
|
+
rules: {
|
|
1830
|
+
canMoveIn: (e) => e.every(
|
|
1831
|
+
(t) => t.data.displayName !== "Body"
|
|
1832
|
+
)
|
|
1833
|
+
}
|
|
1834
|
+
};
|
|
1835
|
+
const Ln = ({ htmlJson: e }) => {
|
|
1836
|
+
const { actions: t } = xe();
|
|
1837
|
+
return jo(() => {
|
|
1838
|
+
e && t.deserialize(e);
|
|
1839
|
+
}, [e]), /* @__PURE__ */ l(ar, { children: /* @__PURE__ */ l(ie, { id: "mainBody", is: dt, canvas: !0 }) });
|
|
1840
|
+
}, Po = ({
|
|
1841
|
+
background: e = "transparent",
|
|
1842
|
+
padding: t = { top: 16, right: 16, bottom: 16, left: 16 },
|
|
1843
|
+
margin: o = { top: 0, right: 0, bottom: 0, left: 0 },
|
|
1844
|
+
width: r = "auto",
|
|
1845
|
+
minHeight: n = 100,
|
|
1846
|
+
maxWidth: s = "none",
|
|
1847
|
+
display: i = "block",
|
|
1848
|
+
flexDirection: c = "column",
|
|
1849
|
+
justifyContent: d = "flex-start",
|
|
1850
|
+
alignItems: u = "stretch",
|
|
1851
|
+
gap: f = 0,
|
|
1852
|
+
borderRadius: h = 8,
|
|
1853
|
+
borderWidth: g = 1,
|
|
1854
|
+
borderColor: a = "transparent",
|
|
1855
|
+
borderStyle: N = "dashed",
|
|
1856
|
+
boxShadow: v = "none",
|
|
1857
|
+
children: b
|
|
1858
|
+
}) => {
|
|
1859
|
+
const {
|
|
1860
|
+
connectors: { connect: C, drag: S },
|
|
1861
|
+
isActive: w
|
|
1862
|
+
} = Je((k) => ({
|
|
1863
|
+
isActive: k.events.selected
|
|
1864
|
+
})), T = typeof t == "object" ? `${t.top}px ${t.right}px ${t.bottom}px ${t.left}px` : `${t}px`, z = typeof o == "object" ? `${o.top}px ${o.right}px ${o.bottom}px ${o.left}px` : `${o}px`, R = [
|
|
1865
|
+
{
|
|
1866
|
+
url: "https://myracereel.com/privacy-data-privacy",
|
|
1867
|
+
name: "Privacy & Data Policy"
|
|
1868
|
+
},
|
|
1869
|
+
{
|
|
1870
|
+
url: "https://myracereel.com/terms-of-service",
|
|
1871
|
+
name: "Terms of Service"
|
|
1872
|
+
},
|
|
1873
|
+
{ url: "https://myracereel.com/faq", name: "FAQ" },
|
|
1874
|
+
{ url: "https://myracereel.com/contact", name: "Contact Us" }
|
|
1875
|
+
];
|
|
1876
|
+
return /* @__PURE__ */ l(
|
|
1877
|
+
et,
|
|
1878
|
+
{
|
|
1879
|
+
style: {
|
|
1880
|
+
backgroundColor: e,
|
|
1881
|
+
padding: T,
|
|
1882
|
+
margin: z,
|
|
1883
|
+
width: r === "auto" ? "100%" : r,
|
|
1884
|
+
minHeight: `${n}px`,
|
|
1885
|
+
maxWidth: s === "none" ? "none" : `${s}px`,
|
|
1886
|
+
display: i,
|
|
1887
|
+
flexDirection: i === "flex" ? c : void 0,
|
|
1888
|
+
justifyContent: i === "flex" ? d : void 0,
|
|
1889
|
+
alignItems: i === "flex" ? u : void 0,
|
|
1890
|
+
gap: i === "flex" ? `${f}px` : void 0,
|
|
1891
|
+
borderRadius: `${h}px`,
|
|
1892
|
+
borderWidth: `${g}px`,
|
|
1893
|
+
borderColor: a,
|
|
1894
|
+
borderStyle: N,
|
|
1895
|
+
boxShadow: v === "none" ? "none" : v
|
|
1896
|
+
},
|
|
1897
|
+
className: "bg-black",
|
|
1898
|
+
ref: (k) => k && C(S(k)),
|
|
1899
|
+
children: /* @__PURE__ */ l("div", { className: "flex justify-center w-full", children: /* @__PURE__ */ B("div", { className: "w-full flex flex-col py-10 gap-y-3.5 ", children: [
|
|
1900
|
+
/* @__PURE__ */ l("div", { className: "flex w-full gap-x-1 justify-center items-center", children: /* @__PURE__ */ l("div", { className: "text-white text-sm", children: "Powered by MyRaceReel" }) }),
|
|
1901
|
+
/* @__PURE__ */ l("div", { className: "flex @md:flex-row @max-md:flex-col md:flex-row justify-center items-center gap-x-6 gap-y-2 w-full flex-col", children: R.map((k) => /* @__PURE__ */ l(
|
|
1902
|
+
"a",
|
|
1903
|
+
{
|
|
1904
|
+
className: "text-white",
|
|
1905
|
+
href: k.url,
|
|
1906
|
+
target: "_blank",
|
|
1907
|
+
children: k.name
|
|
1908
|
+
},
|
|
1909
|
+
k.name
|
|
1910
|
+
)) })
|
|
1911
|
+
] }) })
|
|
1912
|
+
}
|
|
1913
|
+
);
|
|
1914
|
+
};
|
|
1915
|
+
Po.craft = {
|
|
1916
|
+
displayName: "Footer",
|
|
1917
|
+
props: {
|
|
1918
|
+
background: "transparent",
|
|
1919
|
+
padding: { top: 16, right: 16, bottom: 16, left: 16 },
|
|
1920
|
+
margin: { top: 0, right: 0, bottom: 0, left: 0 },
|
|
1921
|
+
width: "auto",
|
|
1922
|
+
minHeight: 100,
|
|
1923
|
+
maxWidth: "none",
|
|
1924
|
+
display: "block",
|
|
1925
|
+
flexDirection: "column",
|
|
1926
|
+
justifyContent: "flex-start",
|
|
1927
|
+
alignItems: "stretch",
|
|
1928
|
+
gap: 0,
|
|
1929
|
+
borderRadius: 8,
|
|
1930
|
+
borderWidth: 1,
|
|
1931
|
+
borderColor: "transparent",
|
|
1932
|
+
borderStyle: "dashed",
|
|
1933
|
+
boxShadow: "none"
|
|
1934
|
+
},
|
|
1935
|
+
related: { settings: Tt }
|
|
1936
|
+
};
|
|
1937
|
+
const Fn = ({ initialData: e, onSave: t, onStateChange: o }) => {
|
|
1938
|
+
var d;
|
|
1939
|
+
const r = sr(), [n, s] = Ne("desktop"), i = ((d = Ro[n]) == null ? void 0 : d.width) || "100%", c = (u) => {
|
|
1940
|
+
if (o)
|
|
1941
|
+
try {
|
|
1942
|
+
const f = u.serialize();
|
|
1943
|
+
o(f);
|
|
1944
|
+
} catch {
|
|
1945
|
+
}
|
|
1946
|
+
};
|
|
1947
|
+
return /* @__PURE__ */ l(
|
|
1948
|
+
lr,
|
|
1949
|
+
{
|
|
1950
|
+
resolver: {
|
|
1951
|
+
Body: dt,
|
|
1952
|
+
Div: tt,
|
|
1953
|
+
Wrapper: et,
|
|
1954
|
+
Section: kt,
|
|
1955
|
+
Container: Ae,
|
|
1956
|
+
Text: Dt,
|
|
1957
|
+
ButtonComponent: At,
|
|
1958
|
+
Heading: It,
|
|
1959
|
+
Image: _t,
|
|
1960
|
+
Img: ir,
|
|
1961
|
+
Divider: zt,
|
|
1962
|
+
Spacer: $t,
|
|
1963
|
+
Video: Lt,
|
|
1964
|
+
Columns: Pt,
|
|
1965
|
+
Link: Mt,
|
|
1966
|
+
Footer: Po
|
|
1967
|
+
},
|
|
1968
|
+
enabled: !0,
|
|
1969
|
+
onNodesChange: (u) => c(u),
|
|
1970
|
+
children: /* @__PURE__ */ l(cr, { value: n, children: /* @__PURE__ */ l(dr, { value: r, children: /* @__PURE__ */ B("div", { className: "flex flex-col h-full", children: [
|
|
1971
|
+
/* @__PURE__ */ B("div", { className: "flex items-center justify-between pb-4 border-b border-border", children: [
|
|
1972
|
+
/* @__PURE__ */ l("h2", { className: "text-lg font-semibold", children: "Page Builder" }),
|
|
1973
|
+
/* @__PURE__ */ l(
|
|
1974
|
+
_n,
|
|
1975
|
+
{
|
|
1976
|
+
onSave: t,
|
|
1977
|
+
deviceSize: n,
|
|
1978
|
+
onDeviceSizeChange: s
|
|
1979
|
+
}
|
|
1980
|
+
)
|
|
1981
|
+
] }),
|
|
1982
|
+
/* @__PURE__ */ B("div", { className: "flex gap-4 mt-4 flex-1 min-h-0", children: [
|
|
1983
|
+
/* @__PURE__ */ l(Xe, { className: "w-56 shrink-0", children: /* @__PURE__ */ B(Ke, { className: "p-4 space-y-6", children: [
|
|
1984
|
+
/* @__PURE__ */ l(br, {}),
|
|
1985
|
+
/* @__PURE__ */ l(zr, {})
|
|
1986
|
+
] }) }),
|
|
1987
|
+
/* @__PURE__ */ l(Xe, { className: "flex-1 overflow-hidden bg-muted/30 flex flex-col", children: /* @__PURE__ */ l(Ke, { className: "p-4 flex-1 flex justify-center overflow-hidden", children: /* @__PURE__ */ l(lt, { className: "h-full w-full", children: /* @__PURE__ */ l("div", { className: "flex justify-center min-h-full", children: /* @__PURE__ */ l(
|
|
1988
|
+
"div",
|
|
1989
|
+
{
|
|
1990
|
+
className: "bg-white rounded-lg min-h-full p-4 border border-dashed border-border transition-all duration-300 shadow-sm",
|
|
1991
|
+
style: {
|
|
1992
|
+
width: typeof i == "number" ? `${i}px` : i,
|
|
1993
|
+
maxWidth: "100%"
|
|
1994
|
+
},
|
|
1995
|
+
children: /* @__PURE__ */ l(Ln, { htmlJson: e })
|
|
1996
|
+
}
|
|
1997
|
+
) }) }) }) }),
|
|
1998
|
+
/* @__PURE__ */ l(Xe, { className: "w-72 shrink-0 flex flex-col", children: /* @__PURE__ */ l(Ke, { className: "p-4 flex-1 overflow-hidden", children: /* @__PURE__ */ l(_r, {}) }) })
|
|
1999
|
+
] })
|
|
2000
|
+
] }) }) })
|
|
2001
|
+
}
|
|
2002
|
+
);
|
|
2003
|
+
};
|
|
2004
|
+
export {
|
|
2005
|
+
Fn as default
|
|
2006
|
+
};
|