@oneclick.dev/cms-core-modules 0.0.53 → 0.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/CalendarDate-CRT2Viyt.mjs +830 -0
  2. package/dist/CalendarDate-CWtpXgpD.js +1 -0
  3. package/dist/Components-D9yIIosM.mjs +623 -0
  4. package/dist/Components-DXbx0RLV.js +1 -0
  5. package/dist/ContentEditor-DRJFQKCv.mjs +34915 -0
  6. package/dist/ContentEditor-DzTi8fSZ.js +290 -0
  7. package/dist/Create-BP8TX6rj.js +1 -0
  8. package/dist/Create-Bwf1RXdG.mjs +1248 -0
  9. package/dist/DateFormatter-BbcSwTs4.js +1 -0
  10. package/dist/DateFormatter-CbO0PVUK.mjs +99 -0
  11. package/dist/Detail-B-PnkcXD.mjs +3473 -0
  12. package/dist/Detail-BVlGSjOq.mjs +380 -0
  13. package/dist/Detail-C4E1T87K.mjs +26 -0
  14. package/dist/Detail-CNfTDUE5.js +1 -0
  15. package/dist/Detail-Cd5CBVN0.js +1 -0
  16. package/dist/Detail-CpfOQChd.mjs +585 -0
  17. package/dist/Detail-CwagT6gQ.mjs +650 -0
  18. package/dist/Detail-DUo6qKqO.js +1 -0
  19. package/dist/Detail-Dd_OkpcN.js +1 -0
  20. package/dist/Detail-mvSGbnFU.js +1 -0
  21. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-BWuKVkvV.js +1 -0
  22. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D0-EcU0_.mjs +55 -0
  23. package/dist/Entries-DcpPvlYj.js +1 -0
  24. package/dist/Entries-QLMtTYLX.mjs +713 -0
  25. package/dist/Find-BPR0uU-Z.mjs +229 -0
  26. package/dist/Find-BidEQJxT.js +1 -0
  27. package/dist/GlobalStyling-CMzPRd18.js +17 -0
  28. package/dist/GlobalStyling-DoLHUJeV.mjs +988 -0
  29. package/dist/Overview-BDlBCUI_.js +1 -0
  30. package/dist/Overview-BH3NwvNX.mjs +26 -0
  31. package/dist/Overview-BLsZMHNW.mjs +178 -0
  32. package/dist/Overview-BNMZ9MUK.js +1 -0
  33. package/dist/Overview-BbvfH1u-.js +1 -0
  34. package/dist/Overview-CDN88OSM.mjs +190 -0
  35. package/dist/Overview-CEPodGCn.mjs +311 -0
  36. package/dist/Overview-CvquDPhB.js +1 -0
  37. package/dist/Overview-D54pjmI6.mjs +633 -0
  38. package/dist/Overview-D67UjG6n.mjs +947 -0
  39. package/dist/Overview-KT2Mgfh5.js +1 -0
  40. package/dist/Overview-T-lsy3UZ.js +1 -0
  41. package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-0xZSq0rx.js +1 -0
  42. package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-Bj_PVLLV.mjs +392 -0
  43. package/dist/TableView-CpO53xcX.js +111 -0
  44. package/dist/TableView-D9J5rUls.mjs +72921 -0
  45. package/dist/TemplateList.vue_vue_type_script_setup_true_lang-B_AtWnHa.js +1 -0
  46. package/dist/TemplateList.vue_vue_type_script_setup_true_lang-BiLAkhIA.mjs +40 -0
  47. package/dist/View-DlHBZbFu.js +1 -0
  48. package/dist/View-Dv5QMrSn.mjs +25 -0
  49. package/dist/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
  50. package/dist/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
  51. package/dist/agenda-B49oKGeh.mjs +706 -0
  52. package/dist/agenda-DipQ5IWP.js +1 -0
  53. package/dist/availability-C7q9tq6l.js +1 -0
  54. package/dist/availability-DeCkqiu8.mjs +613 -0
  55. package/dist/cms-core-modules.css +1 -1
  56. package/dist/countries-BTPvmrsb.mjs +4 -0
  57. package/dist/countries-CgZ081No.js +1 -0
  58. package/dist/exceptions-D3b18TiY.mjs +647 -0
  59. package/dist/exceptions-DJ9zWX3k.js +1 -0
  60. package/dist/floating-ui.dom-C82nbomj.js +1 -0
  61. package/dist/floating-ui.dom-ouSgPqty.mjs +1133 -0
  62. package/dist/google-CvtuJwgk.mjs +4 -0
  63. package/dist/google-D4N3gb01.js +1 -0
  64. package/dist/index--jjEzba7.mjs +24 -0
  65. package/dist/index-9HVlmvK3.js +1 -0
  66. package/dist/index-BEGU8Kme.mjs +12 -0
  67. package/dist/index-Bwi1mtkq.mjs +24 -0
  68. package/dist/index-BzuHN-r8.mjs +24 -0
  69. package/dist/index-CImCyE3L.mjs +24 -0
  70. package/dist/index-CKPshlZ8-BQiiP6r_.mjs +1264 -0
  71. package/dist/index-CKPshlZ8-CIz1tDwX.js +1 -0
  72. package/dist/index-CQiY-oTN.mjs +24 -0
  73. package/dist/index-CSxYBeVA.js +1 -0
  74. package/dist/index-CkiNvRzs.js +1 -0
  75. package/dist/index-Co4ON2Di.js +1 -0
  76. package/dist/index-CwqrAU-H.js +1 -0
  77. package/dist/index-Cz-baGax.js +1 -0
  78. package/dist/index-D2a6wEPh.js +1 -0
  79. package/dist/index-DFQGVHTs.js +1 -0
  80. package/dist/index-DI6mydpm.mjs +138 -0
  81. package/dist/index-DMoyoaks.mjs +22 -0
  82. package/dist/index-DT1wWnUk.mjs +24 -0
  83. package/dist/index-DUeFrD-B.js +1 -0
  84. package/dist/index-DsnoK4ia.mjs +579 -0
  85. package/dist/index-R2oUDsjx.js +1 -0
  86. package/dist/index-RLz1QPrf.mjs +203 -0
  87. package/dist/index-UtjLbLw-.js +1 -0
  88. package/dist/index-_mG-aU3Z.mjs +87 -0
  89. package/dist/index-_sQDF1pH.js +1 -0
  90. package/dist/index-ijdf0d9-.js +1 -0
  91. package/dist/index-klI238nT.mjs +24 -0
  92. package/dist/index.cjs.js +1 -330
  93. package/dist/index.mjs +287 -69051
  94. package/dist/interpolation-BNUjI7LH.js +1 -0
  95. package/dist/interpolation-BpGXqOz8.mjs +59 -0
  96. package/dist/payment-kTjsV0Jj.js +1 -0
  97. package/dist/payment-zpCM0LD-.mjs +981 -0
  98. package/dist/regular-C4_3YXqx.mjs +602 -0
  99. package/dist/regular-DFwPEbZO.js +1 -0
  100. package/dist/regular-slots-4ooEpICB.mjs +67 -0
  101. package/dist/regular-slots-BAVGbomI.js +1 -0
  102. package/dist/resources-MpQkSstv.mjs +563 -0
  103. package/dist/resources-iM28T3dD.js +1 -0
  104. package/dist/src/appointments/index.d.ts +4 -28
  105. package/dist/src/appointments/routes.d.ts +3 -9
  106. package/dist/src/content-manager/index.d.ts +5 -147
  107. package/dist/src/content-manager/routes.d.ts +4 -128
  108. package/dist/src/custom/index.d.ts +2 -2
  109. package/dist/src/custom/routes.d.ts +1 -1
  110. package/dist/src/mail-templates/index.d.ts +2 -30
  111. package/dist/src/mail-templates/routes.d.ts +1 -11
  112. package/dist/src/product-collections/index.d.ts +2 -30
  113. package/dist/src/product-collections/routes.d.ts +1 -11
  114. package/dist/src/products/index.d.ts +2 -30
  115. package/dist/src/products/routes.d.ts +1 -11
  116. package/dist/src/promo-codes/index.d.ts +2 -30
  117. package/dist/src/promo-codes/routes.d.ts +1 -11
  118. package/dist/src/shipping-options/index.d.ts +2 -30
  119. package/dist/src/shipping-options/routes.d.ts +1 -11
  120. package/dist/src/table/index.d.ts +2 -70
  121. package/dist/src/table/routes.d.ts +1 -51
  122. package/dist/utils-BVKy9S2J.mjs +29 -0
  123. package/dist/utils-D6CaKJbp.js +2 -0
  124. package/dist/vee-validate-zod-BPQyEfpF.js +1 -0
  125. package/dist/vee-validate-zod-IXkfh-6Q.mjs +4402 -0
  126. package/package.json +3 -3
@@ -0,0 +1,585 @@
1
+ import { defineComponent as B, inject as G, resolveComponent as c, createBlock as S, openBlock as r, withCtx as l, createVNode as t, createElementVNode as s, createElementBlock as w, createCommentVNode as b, createTextVNode as d, unref as e, isRef as j, toDisplayString as y, withModifiers as Y, watch as Z, provide as R, computed as ee, ref as te, onMounted as le } from "vue";
2
+ import { u as E, a as N, t as oe, o as q, s as M, f as se } from "./vee-validate-zod-IXkfh-6Q.mjs";
3
+ import { X as ne, ImagePlus as ie, Tag as ae, ChevronRight as re, Trash as ce, Loader2 as W } from "lucide-vue-next";
4
+ import { g as ue } from "./google-CvtuJwgk.mjs";
5
+ import { useModulePermissions as de, useModuleRoute as pe, useConfirmation as me, useFirebaseIntegration as fe, useModuleBreadcrumbs as _e } from "@oneclick.dev/cms-kit";
6
+ import { t as z } from "./index-RLz1QPrf.mjs";
7
+ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2" }, be = {
8
+ key: 0,
9
+ class: "text-red-500 text-sm mt-1"
10
+ }, ve = { class: "flex flex-col gap-4" }, Ce = { class: "flex flex-col gap-2" }, we = {
11
+ key: 0,
12
+ class: "text-red-500 text-sm mt-1"
13
+ }, ye = { class: "flex flex-col gap-4" }, he = { class: "flex flex-col gap-2" }, Se = { class: "flex items-center gap-2 mb-2" }, ke = { class: "flex items-center gap-2" }, $e = ["src"], Me = {
14
+ key: 0,
15
+ class: "text-red-500 text-sm mt-1"
16
+ }, Ve = /* @__PURE__ */ B({
17
+ __name: "Main",
18
+ setup(U) {
19
+ const p = G("sources");
20
+ G("defaultSource");
21
+ const { errors: m } = E(), { value: v } = N("title"), { value: n } = N("description"), { value: f } = N("thumbnail"), k = (i) => {
22
+ f.value = i;
23
+ };
24
+ return (i, a) => {
25
+ const _ = c("Label"), V = c("Input"), T = c("Textarea"), I = c("Button"), C = c("MediaPickerDialog"), L = c("CardContent"), F = c("Card");
26
+ return r(), S(F, null, {
27
+ default: l(() => [
28
+ t(L, { class: "flex flex-col gap-4" }, {
29
+ default: l(() => [
30
+ s("div", xe, [
31
+ s("div", ge, [
32
+ t(_, {
33
+ for: "title",
34
+ class: "text-sm mb-2"
35
+ }, {
36
+ default: l(() => [...a[5] || (a[5] = [
37
+ d("Title", -1)
38
+ ])]),
39
+ _: 1
40
+ }),
41
+ t(V, {
42
+ type: "text",
43
+ id: "title",
44
+ placeholder: "Summer collection",
45
+ modelValue: e(v),
46
+ "onUpdate:modelValue": a[0] || (a[0] = ($) => j(v) ? v.value = $ : null)
47
+ }, null, 8, ["modelValue"]),
48
+ e(m).title ? (r(), w("p", be, y(e(m).title), 1)) : b("", !0)
49
+ ])
50
+ ]),
51
+ s("div", ve, [
52
+ s("div", Ce, [
53
+ t(_, {
54
+ for: "description",
55
+ class: "text-sm mb-2"
56
+ }, {
57
+ default: l(() => [...a[6] || (a[6] = [
58
+ d("Description", -1)
59
+ ])]),
60
+ _: 1
61
+ }),
62
+ t(T, {
63
+ id: "description",
64
+ placeholder: "Fresh, vibrant, and bold. The perfect collection for the summer season.",
65
+ modelValue: e(n),
66
+ "onUpdate:modelValue": a[1] || (a[1] = ($) => j(n) ? n.value = $ : null)
67
+ }, null, 8, ["modelValue"]),
68
+ e(m).description ? (r(), w("p", we, y(e(m).description), 1)) : b("", !0)
69
+ ])
70
+ ]),
71
+ s("div", ye, [
72
+ s("div", he, [
73
+ s("div", Se, [
74
+ t(_, {
75
+ for: "media",
76
+ class: "text-sm"
77
+ }, {
78
+ default: l(() => [...a[7] || (a[7] = [
79
+ d("Thumbnail", -1)
80
+ ])]),
81
+ _: 1
82
+ }),
83
+ e(f) ? (r(), S(I, {
84
+ key: 0,
85
+ variant: "ghost",
86
+ size: "icon",
87
+ onClick: a[2] || (a[2] = ($) => f.value = "")
88
+ }, {
89
+ default: l(() => [
90
+ t(e(ne), { class: "size-4" })
91
+ ]),
92
+ _: 1
93
+ })) : b("", !0)
94
+ ]),
95
+ s("div", ke, [
96
+ t(C, {
97
+ sources: e(p),
98
+ maxFiles: 1,
99
+ "initial-value": e(f) ? [e(f)] : [],
100
+ onSubmit: a[4] || (a[4] = ($) => k($))
101
+ }, {
102
+ default: l(() => [
103
+ s("button", {
104
+ onClick: a[3] || (a[3] = Y(() => {
105
+ }, ["stop"])),
106
+ tabindex: "-1",
107
+ class: "cursor-pointer block"
108
+ }, [
109
+ e(f) ? (r(), w("img", {
110
+ key: 1,
111
+ src: e(f),
112
+ class: "size-42 rounded-md object-cover",
113
+ draggable: "false"
114
+ }, null, 8, $e)) : (r(), S(I, {
115
+ key: 0,
116
+ variant: "outline",
117
+ class: "size-42 border-dashed cursor-pointer"
118
+ }, {
119
+ default: l(() => [
120
+ t(e(ie))
121
+ ]),
122
+ _: 1
123
+ }))
124
+ ])
125
+ ]),
126
+ _: 1
127
+ }, 8, ["sources", "initial-value"]),
128
+ e(m).thumbnail ? (r(), w("p", Me, y(e(m).thumbnail), 1)) : b("", !0)
129
+ ])
130
+ ])
131
+ ])
132
+ ]),
133
+ _: 1
134
+ })
135
+ ]),
136
+ _: 1
137
+ });
138
+ };
139
+ }
140
+ }), Te = { class: "bg-white dark:bg-gray-50 border-4 dark:border-gray-600 p-4 rounded-lg mb-4" }, Ie = { class: "flex items-center gap-2 mb-2" }, Pe = ["src"], ze = { class: "text-[#1a0dab] text-lg" }, Ne = { class: "text-[#006621] text-[13px]" }, De = { class: "text-[#545454] text-[13px]" }, Ue = { class: "flex flex-col gap-4 mb-4" }, Fe = { class: "flex flex-col" }, je = {
141
+ key: 0,
142
+ class: "text-red-500 text-sm mt-1"
143
+ }, Be = { class: "flex flex-col gap-4 mb-4" }, Le = { class: "flex flex-col" }, Ee = {
144
+ key: 0,
145
+ class: "text-red-500 text-sm mt-1"
146
+ }, Oe = { class: "flex flex-col gap-4" }, Je = { class: "flex flex-col" }, Ae = {
147
+ key: 0,
148
+ class: "text-red-500 text-sm mt-1"
149
+ }, Ge = {
150
+ key: 1,
151
+ class: "text-[#545454] text-[13px]"
152
+ }, Re = {
153
+ key: 2,
154
+ class: "text-orange-500 text-[13px]"
155
+ }, qe = /* @__PURE__ */ B({
156
+ __name: "SEO",
157
+ setup(U) {
158
+ const { errors: p } = E(), { value: m } = N("title"), { value: v } = N("slug"), { value: n } = N("seo");
159
+ function f(k) {
160
+ return k ? k.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^\w\s-]/g, "").trim().replace(/[-\s]+/g, "-") : "";
161
+ }
162
+ return Z(m, (k, i) => {
163
+ (!v.value || f(i) === v.value) && (v.value = f(k)), (!n.value.title || i === n.value.title) && (n.value.title = k);
164
+ }), (k, i) => {
165
+ const a = c("Label"), _ = c("Input"), V = c("Textarea"), T = c("CardContent"), I = c("Card");
166
+ return r(), S(I, null, {
167
+ default: l(() => [
168
+ t(T, null, {
169
+ default: l(() => [
170
+ i[7] || (i[7] = s("h3", { class: "text-lg font-semibold mb-4" }, "Search engine listing", -1)),
171
+ s("div", Te, [
172
+ s("div", Ie, [
173
+ s("img", {
174
+ src: e(ue),
175
+ alt: "Google",
176
+ class: "w-16 pointer-events-none",
177
+ draggable: "false"
178
+ }, null, 8, Pe),
179
+ i[3] || (i[3] = s("span", { class: "text-[#4186f5] font-medium text-xs" }, "Preview", -1))
180
+ ]),
181
+ s("p", ze, y(e(n).title), 1),
182
+ s("p", Ne, y(e(v)), 1),
183
+ s("p", De, y(e(n).description?.slice(0, 155)) + y(e(n).description?.length > 155 ? " ..." : ""), 1)
184
+ ]),
185
+ s("div", Ue, [
186
+ s("div", Fe, [
187
+ t(a, {
188
+ for: "slug",
189
+ class: "text-sm mb-2"
190
+ }, {
191
+ default: l(() => [...i[4] || (i[4] = [
192
+ d("Slug", -1)
193
+ ])]),
194
+ _: 1
195
+ }),
196
+ t(_, {
197
+ id: "slug",
198
+ placeholder: "t-shirt-with-red-heart",
199
+ modelValue: e(v),
200
+ "onUpdate:modelValue": i[0] || (i[0] = (C) => j(v) ? v.value = C : null)
201
+ }, null, 8, ["modelValue"]),
202
+ e(p).slug ? (r(), w("p", je, y(e(p).slug), 1)) : b("", !0)
203
+ ])
204
+ ]),
205
+ s("div", Be, [
206
+ s("div", Le, [
207
+ t(a, {
208
+ for: "meta-title",
209
+ class: "text-sm mb-2"
210
+ }, {
211
+ default: l(() => [...i[5] || (i[5] = [
212
+ d("Title", -1)
213
+ ])]),
214
+ _: 1
215
+ }),
216
+ t(_, {
217
+ id: "meta-title",
218
+ placeholder: "T-shirt with red heart",
219
+ modelValue: e(n).title,
220
+ "onUpdate:modelValue": i[1] || (i[1] = (C) => e(n).title = C)
221
+ }, null, 8, ["modelValue"]),
222
+ e(p).seo?.title ? (r(), w("p", Ee, y(e(p).seo.title), 1)) : b("", !0)
223
+ ])
224
+ ]),
225
+ s("div", Oe, [
226
+ s("div", Je, [
227
+ t(a, {
228
+ for: "meta-description",
229
+ class: "text-sm mb-2"
230
+ }, {
231
+ default: l(() => [...i[6] || (i[6] = [
232
+ d("Description", -1)
233
+ ])]),
234
+ _: 1
235
+ }),
236
+ t(V, {
237
+ id: "meta-description",
238
+ placeholder: "Lovely T-shirt featuring a red heart",
239
+ modelValue: e(n).description,
240
+ "onUpdate:modelValue": i[2] || (i[2] = (C) => e(n).description = C),
241
+ class: "mb-1 resize-none"
242
+ }, null, 8, ["modelValue"]),
243
+ e(p).seo?.description ? (r(), w("p", Ae, y(e(p).seo.description), 1)) : e(n).description.length < 155 ? (r(), w("p", Ge, y(e(n).description.length) + " characters", 1)) : (r(), w("p", Re, "Please keep it under 155 characters"))
244
+ ])
245
+ ])
246
+ ]),
247
+ _: 1
248
+ })
249
+ ]),
250
+ _: 1
251
+ });
252
+ };
253
+ }
254
+ }), We = { class: "flex items-center gap-2" }, Xe = {
255
+ key: 0,
256
+ class: "size-3 rounded-full bg-green-500"
257
+ }, He = {
258
+ key: 1,
259
+ class: "size-3 rounded-full bg-blue-500"
260
+ }, Ke = /* @__PURE__ */ B({
261
+ __name: "Status",
262
+ setup(U) {
263
+ const { errors: p } = E(), { value: m } = N("status");
264
+ return (v, n) => {
265
+ const f = c("SelectValue"), k = c("SelectTrigger"), i = c("SelectItem"), a = c("SelectGroup"), _ = c("SelectContent"), V = c("Select"), T = c("CardContent"), I = c("Card");
266
+ return r(), S(I, null, {
267
+ default: l(() => [
268
+ t(T, null, {
269
+ default: l(() => [
270
+ n[3] || (n[3] = s("p", { class: "text-md font-semibold mb-2" }, "Status", -1)),
271
+ t(V, {
272
+ modelValue: e(m),
273
+ "onUpdate:modelValue": n[0] || (n[0] = (C) => j(m) ? m.value = C : null),
274
+ class: "w-full"
275
+ }, {
276
+ default: l(() => [
277
+ t(k, { class: "w-full" }, {
278
+ default: l(() => [
279
+ s("div", We, [
280
+ e(m) === "published" ? (r(), w("span", Xe)) : e(m) === "draft" ? (r(), w("span", He)) : b("", !0),
281
+ t(f, { placeholder: "Status" })
282
+ ])
283
+ ]),
284
+ _: 1
285
+ }),
286
+ t(_, null, {
287
+ default: l(() => [
288
+ t(a, null, {
289
+ default: l(() => [
290
+ t(i, { value: "published" }, {
291
+ default: l(() => [...n[1] || (n[1] = [
292
+ s("span", { class: "size-3 rounded-full bg-green-500" }, null, -1),
293
+ d(" Published ", -1)
294
+ ])]),
295
+ _: 1
296
+ }),
297
+ t(i, { value: "draft" }, {
298
+ default: l(() => [...n[2] || (n[2] = [
299
+ s("span", { class: "size-3 rounded-full bg-blue-500" }, null, -1),
300
+ d(" Draft ", -1)
301
+ ])]),
302
+ _: 1
303
+ })
304
+ ]),
305
+ _: 1
306
+ })
307
+ ]),
308
+ _: 1
309
+ })
310
+ ]),
311
+ _: 1
312
+ }, 8, ["modelValue"])
313
+ ]),
314
+ _: 1
315
+ })
316
+ ]),
317
+ _: 1
318
+ });
319
+ };
320
+ }
321
+ }), Qe = { class: "relative @container" }, Ye = { class: "flex flex-row gap-4 justify-between max-w-5xl mx-auto mt-4 mb-6" }, Ze = { class: "flex items-center" }, et = { class: "text-lg font-semibold mx-2" }, tt = {
322
+ key: 0,
323
+ class: "bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"
324
+ }, lt = {
325
+ key: 1,
326
+ class: "bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"
327
+ }, ot = { class: "flex flex-col @3xl:flex-row gap-4 max-w-5xl mx-auto pb-24" }, st = { class: "flex flex-col gap-4 w-full @3xl:w-2/3" }, nt = { class: "flex flex-col gap-4 w-full @3xl:w-1/3" }, it = {
328
+ key: 0,
329
+ class: "fixed bottom-4 left-0 md:left-12 right-0 min-w-xs max-w-5xl w-[calc(100%-2rem)] md:w-[calc(100%-5rem)] xl:w-[calc(100%-2rem)] h-16 border border-white/10 backdrop-blur-sm border-t border-border flex items-center justify-center px-4 mx-auto z-[9999] rounded-xl overflow-hidden shadow bg-[radial-gradient(#ffffff80,transparent)] dark:bg-[radial-gradient(#00000080,transparent)]"
330
+ }, at = { class: "w-full max-w-5xl flex items-center justify-end mx-auto" }, _t = /* @__PURE__ */ B({
331
+ __name: "Detail",
332
+ props: {
333
+ config: {
334
+ type: Object,
335
+ required: !0
336
+ }
337
+ },
338
+ setup(U) {
339
+ const p = U, { hasPermission: m, hasAnyPermission: v } = de(), { params: n, navigateTo: f } = pe(), { confirm: k } = me(), i = fe(p.config.project);
340
+ R("sources", p.config.allowedMediaSources), R("defaultSource", p.config.defaultUploadMediaSource);
341
+ const a = ee(() => !n.value.collectionId || n.value.collectionId === "new"), _ = te(!1), V = oe(q({
342
+ id: M().optional(),
343
+ title: M().min(1, "Title is required"),
344
+ type: M(),
345
+ description: M().optional(),
346
+ thumbnail: M().optional(),
347
+ slug: M(),
348
+ seo: q({
349
+ title: M().optional(),
350
+ description: M().optional()
351
+ }).optional(),
352
+ status: M()
353
+ })), { handleSubmit: T, errors: I, values: C, setValues: L } = se({
354
+ validationSchema: V,
355
+ initialValues: {
356
+ status: "draft",
357
+ type: "manual",
358
+ seo: {
359
+ title: "",
360
+ description: ""
361
+ }
362
+ }
363
+ });
364
+ _e(() => [
365
+ { text: a.value ? "New Collection" : C.title || "Collection" }
366
+ ]);
367
+ const F = T(async (u) => {
368
+ _.value = !0;
369
+ let o = await $() || [];
370
+ if (a.value) {
371
+ let x = JSON.parse(JSON.stringify(u));
372
+ if (x.id = crypto.randomUUID(), await O(x.slug)) {
373
+ z.error("Collection with this slug already exists"), _.value = !1;
374
+ return;
375
+ }
376
+ const h = [...o, x], g = p.config.collectionsCollection.split(":");
377
+ console.log("collectionParts", g[0], { [g[1]]: h }), await i.update(g[0], null, { [g[1]]: h }), f("/"), z.success("Collection created");
378
+ } else {
379
+ let x = JSON.parse(JSON.stringify(u));
380
+ const h = o.map((P) => P.id === n.value.collectionId ? x : P), g = p.config.collectionsCollection.split(":");
381
+ await i.update(g[0], null, { [g[1]]: h }), f("/"), z.success("Collection updated");
382
+ }
383
+ _.value = !1;
384
+ }), $ = async () => {
385
+ if (!p.config.collectionsCollection) return [];
386
+ const u = p.config.collectionsCollection.split(":");
387
+ return u.length !== 2 ? [] : (await i.get(u[0]))?.[u[1]] || [];
388
+ }, X = async () => {
389
+ const o = (await $()).find((x) => x.id === n.value.collectionId);
390
+ L(o);
391
+ }, H = async () => {
392
+ try {
393
+ let u = { ...C }, o = u.slug + "-copy", x = 2;
394
+ for (; await O(o); )
395
+ o = u.slug + "-copy-" + x, x++;
396
+ u.id = crypto.randomUUID(), u.slug = o, u.status = "draft", u.title = u.title + " (copy)";
397
+ const g = [...await $() || [], u], P = p.config.collectionsCollection.split(":");
398
+ await i.update(P[0], null, { [P[1]]: g }), f(u.id), z.success("Collection duplicated");
399
+ } catch {
400
+ z.error("Failed to duplicate collection");
401
+ }
402
+ }, K = async () => {
403
+ if (await k("Are you sure you want to delete this collection?"))
404
+ try {
405
+ const o = await $() || [];
406
+ if (o.length === 0 || !n.value.collectionId) throw new Error("Error loading values");
407
+ const x = o.filter((g) => g.id !== n.value.collectionId), h = p.config.collectionsCollection.split(":");
408
+ await i.update(h[0], null, { [h[1]]: x }), f(""), z.success("Collection deleted");
409
+ } catch {
410
+ z.error("Failed to delete collection");
411
+ }
412
+ }, O = async (u) => !!(await $() || []).find((x) => x.slug === u);
413
+ return le(() => {
414
+ a.value || X();
415
+ }), (u, o) => {
416
+ const x = c("Button"), h = c("MenubarTrigger"), g = c("MenubarMenu"), P = c("MenubarShortcut"), D = c("MenubarItem"), J = c("MenubarSeparator"), A = c("MenubarContent"), Q = c("Menubar");
417
+ return r(), w("div", Qe, [
418
+ s("div", Ye, [
419
+ s("div", Ze, [
420
+ t(x, {
421
+ variant: "ghost",
422
+ onClick: o[0] || (o[0] = (rt) => e(f)(""))
423
+ }, {
424
+ default: l(() => [
425
+ t(e(ae), { class: "size-4" })
426
+ ]),
427
+ _: 1
428
+ }),
429
+ t(e(re), { class: "size-3" }),
430
+ s("h1", et, y(a.value ? "New Collection" : e(C).title), 1),
431
+ e(C).status === "published" ? (r(), w("span", tt, "Published")) : e(C).status === "draft" ? (r(), w("span", lt, "Draft")) : b("", !0)
432
+ ]),
433
+ a.value ? b("", !0) : (r(), S(Q, {
434
+ key: 0,
435
+ class: "bg-sidebar"
436
+ }, {
437
+ default: l(() => [
438
+ e(m)("create-collection") ? (r(), S(g, { key: 0 }, {
439
+ default: l(() => [
440
+ t(h, { onClick: H }, {
441
+ default: l(() => [...o[1] || (o[1] = [
442
+ d("Duplicate", -1)
443
+ ])]),
444
+ _: 1
445
+ })
446
+ ]),
447
+ _: 1
448
+ })) : b("", !0),
449
+ t(g, null, {
450
+ default: l(() => [
451
+ t(h, null, {
452
+ default: l(() => [...o[2] || (o[2] = [
453
+ d("Preview", -1)
454
+ ])]),
455
+ _: 1
456
+ })
457
+ ]),
458
+ _: 1
459
+ }),
460
+ t(g, null, {
461
+ default: l(() => [
462
+ t(h, null, {
463
+ default: l(() => [...o[3] || (o[3] = [
464
+ d("Share", -1)
465
+ ])]),
466
+ _: 1
467
+ }),
468
+ t(A, null, {
469
+ default: l(() => [
470
+ t(D, null, {
471
+ default: l(() => [
472
+ o[5] || (o[5] = d(" New Tab ", -1)),
473
+ t(P, null, {
474
+ default: l(() => [...o[4] || (o[4] = [
475
+ d("⌘T", -1)
476
+ ])]),
477
+ _: 1
478
+ })
479
+ ]),
480
+ _: 1
481
+ }),
482
+ t(D, null, {
483
+ default: l(() => [...o[6] || (o[6] = [
484
+ d("New Window", -1)
485
+ ])]),
486
+ _: 1
487
+ }),
488
+ t(J),
489
+ t(D, null, {
490
+ default: l(() => [...o[7] || (o[7] = [
491
+ d("Share", -1)
492
+ ])]),
493
+ _: 1
494
+ }),
495
+ t(J),
496
+ t(D, null, {
497
+ default: l(() => [...o[8] || (o[8] = [
498
+ d("Print", -1)
499
+ ])]),
500
+ _: 1
501
+ })
502
+ ]),
503
+ _: 1
504
+ })
505
+ ]),
506
+ _: 1
507
+ }),
508
+ e(v)("edit-collection", "delete-collection") ? (r(), S(g, { key: 1 }, {
509
+ default: l(() => [
510
+ t(h, null, {
511
+ default: l(() => [...o[9] || (o[9] = [
512
+ d("More actions", -1)
513
+ ])]),
514
+ _: 1
515
+ }),
516
+ t(A, null, {
517
+ default: l(() => [
518
+ e(m)("delete-collection") ? (r(), S(D, {
519
+ key: 0,
520
+ variant: "destructive",
521
+ onClick: K
522
+ }, {
523
+ default: l(() => [
524
+ t(e(ce), { class: "size-4" }),
525
+ o[10] || (o[10] = d(" Delete collection ", -1))
526
+ ]),
527
+ _: 1
528
+ })) : b("", !0)
529
+ ]),
530
+ _: 1
531
+ })
532
+ ]),
533
+ _: 1
534
+ })) : b("", !0)
535
+ ]),
536
+ _: 1
537
+ }))
538
+ ]),
539
+ s("div", ot, [
540
+ s("div", st, [
541
+ t(Ve),
542
+ t(qe)
543
+ ]),
544
+ s("div", nt, [
545
+ t(Ke)
546
+ ])
547
+ ]),
548
+ e(v)("create-collection", "edit-collection") ? (r(), w("div", it, [
549
+ s("div", at, [
550
+ a.value && e(m)("create-collection") ? (r(), S(x, {
551
+ key: 0,
552
+ onClick: e(F),
553
+ disabled: _.value
554
+ }, {
555
+ default: l(() => [
556
+ _.value ? (r(), S(e(W), {
557
+ key: 0,
558
+ class: "size-4 animate-spin"
559
+ })) : b("", !0),
560
+ d(" " + y(_.value ? "Creating" : "Create") + " New Collection ", 1)
561
+ ]),
562
+ _: 1
563
+ }, 8, ["onClick", "disabled"])) : e(m)("edit-collection") ? (r(), S(x, {
564
+ key: 1,
565
+ onClick: e(F),
566
+ disabled: _.value
567
+ }, {
568
+ default: l(() => [
569
+ _.value ? (r(), S(e(W), {
570
+ key: 0,
571
+ class: "size-4 animate-spin"
572
+ })) : b("", !0),
573
+ d(" " + y(_.value ? "Saving" : "Save") + " Changes ", 1)
574
+ ]),
575
+ _: 1
576
+ }, 8, ["onClick", "disabled"])) : b("", !0)
577
+ ])
578
+ ])) : b("", !0)
579
+ ]);
580
+ };
581
+ }
582
+ });
583
+ export {
584
+ _t as default
585
+ };