@ozdao/prometheus-framework 0.0.88 → 0.0.89

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-300fcb55.js +1 -0
  2. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-afba007a.mjs +1944 -0
  3. package/dist/ButtonFollow-001c4a65.mjs +130 -0
  4. package/dist/ButtonFollow-48043cc7.js +1 -0
  5. package/dist/CardHeader-0677d446.js +1 -0
  6. package/dist/CardHeader-e361dada.mjs +96 -0
  7. package/dist/CardOrganization-51309400.js +1 -0
  8. package/dist/CardOrganization-bacc2ef6.mjs +202 -0
  9. package/dist/Feed-4b28adc5.mjs +423 -0
  10. package/dist/Feed-5d8d5c21.js +1 -0
  11. package/dist/Feed-76b2997e.mjs +367 -0
  12. package/dist/Feed-eeb63363.js +1 -0
  13. package/dist/IconEdit-3028a3b7.js +1 -0
  14. package/dist/IconEdit-8df23653.mjs +205 -0
  15. package/dist/Image-30f04604.js +9 -0
  16. package/dist/Image-6ec294f3.mjs +477 -0
  17. package/dist/PlaceholderUserpic-10fd9026.js +1 -0
  18. package/dist/PlaceholderUserpic-eb9820ce.mjs +28 -0
  19. package/dist/Popup-7c331e1c.js +1 -0
  20. package/dist/Popup-bdf043ba.mjs +76 -0
  21. package/dist/Product-b233e2a3.js +7 -0
  22. package/dist/Product-eb00f35e.mjs +837 -0
  23. package/dist/ProductEdit-61413d02.mjs +349 -0
  24. package/dist/ProductEdit-fca68ff9.js +1 -0
  25. package/dist/ProfileBlogposts-6704a38c.js +1 -0
  26. package/dist/ProfileBlogposts-775b1cfa.mjs +63 -0
  27. package/dist/ProfileComments-175e42da.js +1 -0
  28. package/dist/ProfileComments-fd7d66bf.mjs +43 -0
  29. package/dist/ProfileEvents-4f2a5f00.js +1 -0
  30. package/dist/ProfileEvents-7a51a9e6.mjs +55 -0
  31. package/dist/ProfileLikes-20a8a3c9.mjs +43 -0
  32. package/dist/ProfileLikes-b3b1350a.js +1 -0
  33. package/dist/ProfileOrganizations-4b866823.mjs +211 -0
  34. package/dist/ProfileOrganizations-6d3a43e4.js +1 -0
  35. package/dist/Publics-0e44c61e.mjs +122 -0
  36. package/dist/Publics-4e1c14fc.js +1 -0
  37. package/dist/Tab-a243605d.mjs +46 -0
  38. package/dist/UploadImage-6e312c46.mjs +83 -0
  39. package/dist/UploadImage-9e7e7468.js +1 -0
  40. package/dist/auth-2bc18d1e.js +8 -0
  41. package/dist/auth-fefd15a3.mjs +1503 -0
  42. package/dist/auth.client.cjs +1 -1
  43. package/dist/auth.client.js +5 -5
  44. package/dist/auth.validation-4a617c0b.mjs +20 -0
  45. package/dist/auth.validation-78a90fed.js +1 -0
  46. package/dist/community.client.cjs +1 -1
  47. package/dist/community.client.js +14 -13
  48. package/dist/components/Field/Field.vue.d.ts.map +1 -1
  49. package/dist/components/FieldPhone/FieldPhone(script-setup).vue.d.ts +3 -3
  50. package/dist/components/FieldPhone/FieldPhone.vue.d.ts +1 -1
  51. package/dist/events.client.cjs +1 -1
  52. package/dist/events.client.js +12 -11
  53. package/dist/inputs.validation-14e8e01f.mjs +93 -0
  54. package/dist/main.css +1 -1
  55. package/dist/organizations-1581c013.mjs +121 -0
  56. package/dist/organizations-c455dad7.js +1 -0
  57. package/dist/organizations.client-040ec107.js +3 -0
  58. package/dist/organizations.client-7937e180.mjs +3037 -0
  59. package/dist/organizations.client.cjs +1 -1
  60. package/dist/organizations.client.js +39 -39
  61. package/dist/organizations.server.js +7 -3
  62. package/dist/organizations.server.mjs +7 -3
  63. package/dist/prometheus-framework.cjs.js +1 -1
  64. package/dist/prometheus-framework.es.js +3 -2
  65. package/dist/style.css +1 -1
  66. package/dist/users.client.cjs +1 -1
  67. package/dist/users.client.js +265 -256
  68. package/dist/users.server.js +2 -2
  69. package/dist/users.server.mjs +2 -2
  70. package/package.json +1 -1
  71. package/src/components/Field/Field.vue +2 -1
  72. package/src/modules/community/components/pages/CreateBlogPost.vue +2 -1
  73. package/src/modules/events/components/pages/EditEvent.vue +2 -1
  74. package/src/modules/organizations/components/blocks/Socials.vue +16 -3
  75. package/src/modules/organizations/components/pages/OrganizationEdit.vue +39 -15
  76. package/src/modules/organizations/components/sections/DetailsTab.vue +13 -9
  77. package/src/modules/organizations/controllers/organizations.controller.js +1 -1
  78. package/src/modules/organizations/models/organization.model.js +6 -2
  79. package/src/modules/organizations/store/organizations.js +2 -2
  80. package/src/modules/users/components/pages/Profile.vue +26 -11
  81. package/src/modules/users/components/pages/ProfileEdit.vue +28 -10
  82. package/src/modules/users/models/user.model.js +2 -2
  83. package/src/modules/users/store/users.js +1 -2
@@ -0,0 +1,423 @@
1
+ import { reactive as L, watch as I, openBlock as o, createElementBlock as l, toDisplayString as u, createCommentVNode as i, createElementVNode as b, ref as p, createTextVNode as z, computed as B, createVNode as _, normalizeClass as O, unref as d, renderSlot as A, onMounted as T, Transition as x, withCtx as $, createBlock as j, Fragment as U, renderList as E } from "vue";
2
+ import { _ as M } from "./EmptyState-34d85f10.mjs";
3
+ import { a as N, _ as F } from "./auth-fefd15a3.mjs";
4
+ import { _ as V } from "./CardHeader-e361dada.mjs";
5
+ import { useRouter as q } from "vue-router";
6
+ import { s as g } from "./globals-96ba60e4.mjs";
7
+ const k = N.create({ baseURL: process.env.API_URL, withCredentials: !0 });
8
+ k.defaults.withCredentials = !0;
9
+ const f = L({
10
+ all: [],
11
+ filter: {
12
+ // query
13
+ tags: [],
14
+ period: ""
15
+ // pagination
16
+ },
17
+ pagination: {
18
+ page: 1,
19
+ perPage: 18
20
+ },
21
+ // Sort
22
+ sort: {
23
+ current: "popularity",
24
+ ascending: !1
25
+ },
26
+ current: {
27
+ _id: "",
28
+ url: "",
29
+ status: "",
30
+ name: "",
31
+ tags: [],
32
+ owner: {},
33
+ date: "",
34
+ views: 0,
35
+ content: []
36
+ }
37
+ });
38
+ async function S(e = {}) {
39
+ e.params = e.params || {}, e.params.skip = e.skip || 0, e.params.limit = e.limit || 9, e.params.tags = e.tags || [], e.period && (e.params.period = e.period), e.url && (e.params = { url: e.url }), e.category && (e.params.category = e.category), e.organization && (e.params.organization = e.organization), e.owner && (e.params.owner = e.owner), e.creator && (e.params.creator = e.creator), e.status && (e.params.status = e.status), e.user && (e.params.user = e.user), e.params.skip = e.skip || 0, e.params.limit = e.limit || 10;
40
+ try {
41
+ console.log("Request params:" + e.params);
42
+ const t = await k.get("/api/blog/read", { params: e.params });
43
+ return e.url ? w(t.data, "current") : w(t.data, "all"), Promise.resolve(t.data);
44
+ } catch (t) {
45
+ return g(t), Promise.reject(t);
46
+ }
47
+ }
48
+ async function D(e) {
49
+ return k.post("/api/blog/create", e).then(
50
+ (t) => (w(t.data, "current"), Promise.resolve(t.data)),
51
+ (t) => (g(t), Promise.reject(t))
52
+ );
53
+ }
54
+ async function G(e) {
55
+ return k.post("/api/blog/update", e).then(
56
+ (t) => (w(t.data, "current"), Promise.resolve(t.data)),
57
+ (t) => (g(t), Promise.reject(t))
58
+ );
59
+ }
60
+ async function H(e) {
61
+ return await k.delete(`/api/blog/delete/${e}`).then(
62
+ (t) => {
63
+ const a = f.all.findIndex((r) => r._id === e);
64
+ return a !== -1 && f.all.splice(a, 1), Promise.resolve(t.data);
65
+ },
66
+ (t) => (g(t), Promise.reject(t))
67
+ );
68
+ }
69
+ function w(e, t) {
70
+ f[t] = e;
71
+ }
72
+ function J() {
73
+ f.current = {
74
+ _id: "",
75
+ url: "",
76
+ status: "",
77
+ name: "",
78
+ tags: [],
79
+ author: "",
80
+ owner: "",
81
+ date: "",
82
+ views: 0,
83
+ content: []
84
+ };
85
+ }
86
+ function K(e) {
87
+ const t = {
88
+ order: f.project.content.length + 1,
89
+ type: e.type,
90
+ data: e.data,
91
+ class: e.class,
92
+ content: e.content
93
+ };
94
+ f.project.content.push(t);
95
+ }
96
+ I(f, (e, t) => {
97
+ });
98
+ const xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
99
+ __proto__: null,
100
+ blockAdd: K,
101
+ clean: J,
102
+ create: D,
103
+ read: S,
104
+ remove: H,
105
+ set: w,
106
+ state: f,
107
+ update: G
108
+ }, Symbol.toStringTag, { value: "Module" })), Q = {
109
+ props: {
110
+ progress: {
111
+ type: Number,
112
+ default: null
113
+ },
114
+ status: {
115
+ type: String,
116
+ default: null
117
+ }
118
+ }
119
+ }, W = { class: "circular-loader" }, X = /* @__PURE__ */ b("svg", { viewBox: "25 25 50 50" }, [
120
+ /* @__PURE__ */ b("circle", {
121
+ cx: "50",
122
+ cy: "50",
123
+ r: "20",
124
+ fill: "none",
125
+ "stroke-width": "4",
126
+ "stroke-miterlimit": "10"
127
+ })
128
+ ], -1), Y = {
129
+ key: 0,
130
+ class: "progress-text"
131
+ }, Z = {
132
+ key: 1,
133
+ class: "uppercase t-semi w-m-10r status-text"
134
+ };
135
+ function ee(e, t, a, r, s, c) {
136
+ return o(), l("div", W, [
137
+ X,
138
+ a.progress ? (o(), l("div", Y, u(a.progress), 1)) : i("", !0),
139
+ a.status ? (o(), l("div", Z, u(a.status), 1)) : i("", !0)
140
+ ]);
141
+ }
142
+ const te = /* @__PURE__ */ F(Q, [["render", ee]]), P = N.create({
143
+ baseURL: process.env.API_URL,
144
+ withCredentials: !0
145
+ }), y = L({
146
+ reactions: [],
147
+ error: null
148
+ }), C = {
149
+ async read({ user: e, type: t, target: a, role: r }) {
150
+ try {
151
+ const s = await P.get("/api/reactions", { params: { user: e, type: t, target: a, role: r } });
152
+ return y.error = null, y.reactions = s.data, Promise.resolve(s.data);
153
+ } catch (s) {
154
+ return g(s), Promise.reject(s);
155
+ }
156
+ },
157
+ async create(e) {
158
+ try {
159
+ const t = await P.post("/api/reactions/create", e);
160
+ return y.error = null, Promise.resolve(t.data);
161
+ } catch (t) {
162
+ return console.log(t), g(t), Promise.reject(t);
163
+ }
164
+ },
165
+ async update(e) {
166
+ try {
167
+ const t = await P.post("/api/reactions/update", e);
168
+ return y.error = null, Promise.resolve(t.data);
169
+ } catch (t) {
170
+ return g(t), Promise.reject(t);
171
+ }
172
+ },
173
+ async delete(e) {
174
+ try {
175
+ const t = await P.post("/api/reactions/delete", e);
176
+ return y.error = null, Promise.resolve(t.data);
177
+ } catch (t) {
178
+ return g(t), Promise.reject(t);
179
+ }
180
+ }
181
+ }, re = {
182
+ handleReactionUpdate(e, t, a) {
183
+ let r;
184
+ if (Array.isArray(e) ? r = e.find((s) => s._id === t.target) : typeof e == "object" && e._id === t.target && (r = e), r)
185
+ if (r.hasReaction = a, a)
186
+ r.reactions.push(t), r.numberOfReactions += 1;
187
+ else {
188
+ const s = r.reactions.findIndex((c) => c._id === t._id);
189
+ s !== -1 && (r.reactions.splice(s, 1), r.numberOfReactions -= 1);
190
+ }
191
+ }
192
+ };
193
+ I(y, (e) => {
194
+ });
195
+ const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
196
+ __proto__: null,
197
+ actions: C,
198
+ mutations: re,
199
+ state: y
200
+ }, Symbol.toStringTag, { value: "Module" })), ae = { class: "t-semi br-top-dark flex-nowrap flex-nojustify flex" }, se = /* @__PURE__ */ b("span", { class: "mn-r-small mn-l-small d-block" }, "·", -1), oe = { class: "cursor-pointer" }, ne = /* @__PURE__ */ b("span", { class: "mn-r-small mn-l-small d-block" }, "·", -1), le = {
201
+ __name: "FooterBlogpost",
202
+ props: ["blogpost", "owner", "user"],
203
+ setup(e) {
204
+ const t = e, a = p(t.blogpost.numberOfReactions), r = p(t.blogpost.isReacted), s = p(t.blogpost.reactionId);
205
+ async function c(v) {
206
+ if (!t.user) {
207
+ alert("Please login to add a reaction");
208
+ return;
209
+ }
210
+ try {
211
+ const n = {
212
+ target: t.blogpost._id,
213
+ type: "blogpost",
214
+ user: t.user,
215
+ class: "like"
216
+ }, h = await C.create(n);
217
+ h.reaction.class === "like" && (a.value += 1, r.value = !0, s.value = h.reaction._id);
218
+ } catch (n) {
219
+ console.error(n), alert("Error adding reaction. Please try again later.");
220
+ }
221
+ }
222
+ async function m(v) {
223
+ if (!t.user) {
224
+ alert("Please login to add a reaction");
225
+ return;
226
+ }
227
+ try {
228
+ const n = { _id: s.value };
229
+ await C.delete(n), a.value -= 1, r.value = !1, s.value = null;
230
+ } catch {
231
+ alert("Error adding reaction. Please try again later.");
232
+ }
233
+ }
234
+ return (v, n) => (o(), l("footer", ae, [
235
+ z(" 👁️ " + u(e.blogpost.views) + " ", 1),
236
+ se,
237
+ b("div", oe, [
238
+ r.value ? i("", !0) : (o(), l("div", {
239
+ key: 0,
240
+ class: "cursor-pointer",
241
+ onClick: n[0] || (n[0] = (h) => c())
242
+ }, " 👍 " + u(a.value), 1)),
243
+ r.value ? (o(), l("div", {
244
+ key: 1,
245
+ class: "cursor-pointer",
246
+ onClick: n[1] || (n[1] = (h) => m())
247
+ }, " 👍 " + u(a.value), 1)) : i("", !0)
248
+ ]),
249
+ ne,
250
+ z(" 💬 " + u(e.blogpost.numberOfComments), 1)
251
+ ]));
252
+ }
253
+ }, ce = { class: "bg-grey radius-big" }, ie = ["src"], ue = { class: "pd-t-zero pd-medium" }, de = {
254
+ key: 0,
255
+ class: "cursor-pointer mn-thin flex-nowrap flex w-100"
256
+ }, me = {
257
+ key: 0,
258
+ class: "pd-micro t-white uppercase t-semi p-small flex-center flex pd-r-small pd-l-small mn-l-thin w-min bg-second radius-extra"
259
+ }, pe = {
260
+ key: 1,
261
+ class: "mn-small t-transp p-big"
262
+ }, ge = {
263
+ key: 2,
264
+ class: "mn-small h2"
265
+ }, fe = {
266
+ __name: "CardBlogpost",
267
+ props: ["blogpost", "user", "type"],
268
+ setup(e) {
269
+ const t = e, a = q(), r = B(() => t.blogpost.content.find((c) => c.type === "ImageUpload")), s = B(() => t.blogpost.content.find((c) => c.type === "Textarea"));
270
+ return (c, m) => (o(), l("article", ce, [
271
+ _(V, {
272
+ class: O({
273
+ "mn-small pd-medium": e.type !== "short",
274
+ "flex-child-order-last flex-child mn-l-small": e.type === "short"
275
+ }),
276
+ owner: e.blogpost.owner,
277
+ creator: e.blogpost.creator,
278
+ date: e.blogpost.createdAt
279
+ }, null, 8, ["class", "owner", "creator", "date"]),
280
+ d(r) && d(r).content && e.type !== "blogpostPage" ? (o(), l("img", {
281
+ key: 0,
282
+ src: d(r).content,
283
+ alt: "Blog post image",
284
+ class: "mn-medium object-fit-cover w-100 h-20r"
285
+ }, null, 8, ie)) : i("", !0),
286
+ b("section", ue, [
287
+ e.type !== "blogpostPage" ? (o(), l("div", de, [
288
+ b("h3", {
289
+ onClick: m[0] || (m[0] = (v) => d(a).push({
290
+ name: "BlogPost",
291
+ params: {
292
+ url: e.blogpost.url
293
+ }
294
+ })),
295
+ class: ""
296
+ }, u(e.blogpost.name), 1),
297
+ e.blogpost.status === "draft" ? (o(), l("div", me, u(e.blogpost.status), 1)) : i("", !0)
298
+ ])) : i("", !0),
299
+ d(s) && d(s).content && e.type !== "blogpostPage" ? (o(), l("p", pe, u(d(s).content.slice(0, 120)) + "... ", 1)) : i("", !0),
300
+ e.type === "blogpostPage" ? (o(), l("h3", ge, u(e.blogpost.name), 1)) : i("", !0),
301
+ A(c.$slots, "default")
302
+ ]),
303
+ _(le, {
304
+ class: "pd-t-zero pd-medium",
305
+ blogpost: e.blogpost,
306
+ user: e.user
307
+ }, null, 8, ["blogpost", "user"])
308
+ ]));
309
+ }
310
+ }, ye = { class: "feed" }, be = { key: 1 }, je = {
311
+ __name: "Feed",
312
+ props: {
313
+ category: {
314
+ type: String,
315
+ default: null
316
+ },
317
+ owner: {
318
+ type: String,
319
+ default: null
320
+ },
321
+ creator: {
322
+ type: String,
323
+ default: null
324
+ },
325
+ status: {
326
+ type: String,
327
+ default: "published"
328
+ },
329
+ user: {
330
+ type: [String, Number],
331
+ default: null
332
+ },
333
+ period: {
334
+ type: String,
335
+ default: null
336
+ }
337
+ },
338
+ setup(e) {
339
+ const t = e, a = p([]), r = p(!0);
340
+ let s = p(!0), c = p(0), m = p(2);
341
+ const v = async () => {
342
+ if (r.value) {
343
+ c.value += m.value;
344
+ const n = await S({
345
+ skip: c.value,
346
+ limit: m.value,
347
+ category: t.category,
348
+ user: t.user,
349
+ owner: t.owner,
350
+ status: t.status,
351
+ creator: t.creator,
352
+ period: t.period
353
+ });
354
+ n.length === 0 && (r.value = !1), a.value = [...a.value, ...n];
355
+ }
356
+ };
357
+ return T(async () => {
358
+ const n = await S({
359
+ skip: c.value,
360
+ limit: m.value,
361
+ category: t.category,
362
+ user: t.user,
363
+ owner: t.owner,
364
+ status: t.status,
365
+ creator: t.creator,
366
+ period: t.period
367
+ });
368
+ n.length === 0 ? r.value = !1 : r.value = !0, a.value = n, s.value = !1;
369
+ }), (n, h) => (o(), l("section", ye, [
370
+ _(x, { name: "fade" }, {
371
+ default: $(() => [
372
+ d(s) ? (o(), j(te, {
373
+ key: 0,
374
+ class: "z-index-5 pos-t-50 left-t-50 pos-absolute"
375
+ })) : i("", !0)
376
+ ]),
377
+ _: 1
378
+ }),
379
+ _(x, { name: "fade" }, {
380
+ default: $(() => [
381
+ !d(s) && a.value.length < 1 ? (o(), j(M, {
382
+ key: 0,
383
+ title: "No Blog Posts Found",
384
+ description: "Currently, there are no posts available in this blog. Please check back later.",
385
+ class: "pd-medium mn-thin bg-grey radius-big"
386
+ })) : (o(), l("div", be, [
387
+ (o(!0), l(U, null, E(a.value, (R) => (o(), j(fe, {
388
+ key: R._id,
389
+ blogpost: R,
390
+ user: e.user,
391
+ class: "mn-medium"
392
+ }, null, 8, ["blogpost", "user"]))), 128)),
393
+ _(x, { name: "fade" }, {
394
+ default: $(() => [
395
+ r.value && a.value.length > 0 ? (o(), l("button", {
396
+ key: 0,
397
+ onClick: v,
398
+ class: "w-100 bg-main button"
399
+ }, " Load more ")) : i("", !0)
400
+ ]),
401
+ _: 1
402
+ })
403
+ ]))
404
+ ]),
405
+ _: 1
406
+ })
407
+ ]));
408
+ }
409
+ };
410
+ export {
411
+ te as L,
412
+ je as _,
413
+ D as a,
414
+ H as b,
415
+ J as c,
416
+ fe as d,
417
+ le as e,
418
+ xe as f,
419
+ $e as g,
420
+ S as r,
421
+ f as s,
422
+ G as u
423
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),C=require("./EmptyState-7658d7d6.js"),v=require("./auth-2bc18d1e.js"),S=require("./CardHeader-0677d446.js"),V=require("vue-router"),u=require("./globals-928eb13c.js"),f=v.axios.create({baseURL:process.env.API_URL,withCredentials:!0});f.defaults.withCredentials=!0;const c=e.reactive({all:[],filter:{tags:[],period:""},pagination:{page:1,perPage:18},sort:{current:"popularity",ascending:!1},current:{_id:"",url:"",status:"",name:"",tags:[],owner:{},date:"",views:0,content:[]}});async function k(t={}){t.params=t.params||{},t.params.skip=t.skip||0,t.params.limit=t.limit||9,t.params.tags=t.tags||[],t.period&&(t.params.period=t.period),t.url&&(t.params={url:t.url}),t.category&&(t.params.category=t.category),t.organization&&(t.params.organization=t.organization),t.owner&&(t.params.owner=t.owner),t.creator&&(t.params.creator=t.creator),t.status&&(t.params.status=t.status),t.user&&(t.params.user=t.user),t.params.skip=t.skip||0,t.params.limit=t.limit||10;try{console.log("Request params:"+t.params);const r=await f.get("/api/blog/read",{params:t.params});return t.url?g(r.data,"current"):g(r.data,"all"),Promise.resolve(r.data)}catch(r){return u.setError(r),Promise.reject(r)}}async function w(t){return f.post("/api/blog/create",t).then(r=>(g(r.data,"current"),Promise.resolve(r.data)),r=>(u.setError(r),Promise.reject(r)))}async function _(t){return f.post("/api/blog/update",t).then(r=>(g(r.data,"current"),Promise.resolve(r.data)),r=>(u.setError(r),Promise.reject(r)))}async function B(t){return await f.delete(`/api/blog/delete/${t}`).then(r=>{const o=c.all.findIndex(a=>a._id===t);return o!==-1&&c.all.splice(o,1),Promise.resolve(r.data)},r=>(u.setError(r),Promise.reject(r)))}function g(t,r){c[r]=t}function x(){c.current={_id:"",url:"",status:"",name:"",tags:[],author:"",owner:"",date:"",views:0,content:[]}}function $(t){const r={order:c.project.content.length+1,type:t.type,data:t.data,class:t.class,content:t.content};c.project.content.push(r)}e.watch(c,(t,r)=>{});const j=Object.freeze(Object.defineProperty({__proto__:null,blockAdd:$,clean:x,create:w,read:k,remove:B,set:g,state:c,update:_},Symbol.toStringTag,{value:"Module"})),R={props:{progress:{type:Number,default:null},status:{type:String,default:null}}},D={class:"circular-loader"},z=e.createElementVNode("svg",{viewBox:"25 25 50 50"},[e.createElementVNode("circle",{cx:"50",cy:"50",r:"20",fill:"none","stroke-width":"4","stroke-miterlimit":"10"})],-1),L={key:0,class:"progress-text"},T={key:1,class:"uppercase t-semi w-m-10r status-text"};function I(t,r,o,a,s,l){return e.openBlock(),e.createElementBlock("div",D,[z,o.progress?(e.openBlock(),e.createElementBlock("div",L,e.toDisplayString(o.progress),1)):e.createCommentVNode("",!0),o.status?(e.openBlock(),e.createElementBlock("div",T,e.toDisplayString(o.status),1)):e.createCommentVNode("",!0)])}const E=v._export_sfc(R,[["render",I]]),y=v.axios.create({baseURL:process.env.API_URL,withCredentials:!0}),d=e.reactive({reactions:[],error:null}),b={async read({user:t,type:r,target:o,role:a}){try{const s=await y.get("/api/reactions",{params:{user:t,type:r,target:o,role:a}});return d.error=null,d.reactions=s.data,Promise.resolve(s.data)}catch(s){return u.setError(s),Promise.reject(s)}},async create(t){try{const r=await y.post("/api/reactions/create",t);return d.error=null,Promise.resolve(r.data)}catch(r){return console.log(r),u.setError(r),Promise.reject(r)}},async update(t){try{const r=await y.post("/api/reactions/update",t);return d.error=null,Promise.resolve(r.data)}catch(r){return u.setError(r),Promise.reject(r)}},async delete(t){try{const r=await y.post("/api/reactions/delete",t);return d.error=null,Promise.resolve(r.data)}catch(r){return u.setError(r),Promise.reject(r)}}},O={handleReactionUpdate(t,r,o){let a;if(Array.isArray(t)?a=t.find(s=>s._id===r.target):typeof t=="object"&&t._id===r.target&&(a=t),a)if(a.hasReaction=o,o)a.reactions.push(r),a.numberOfReactions+=1;else{const s=a.reactions.findIndex(l=>l._id===r._id);s!==-1&&(a.reactions.splice(s,1),a.numberOfReactions-=1)}}};e.watch(d,t=>{});const q=Object.freeze(Object.defineProperty({__proto__:null,actions:b,mutations:O,state:d},Symbol.toStringTag,{value:"Module"})),A={class:"t-semi br-top-dark flex-nowrap flex-nojustify flex"},U=e.createElementVNode("span",{class:"mn-r-small mn-l-small d-block"},"·",-1),M={class:"cursor-pointer"},F=e.createElementVNode("span",{class:"mn-r-small mn-l-small d-block"},"·",-1),P={__name:"FooterBlogpost",props:["blogpost","owner","user"],setup(t){const r=t,o=e.ref(r.blogpost.numberOfReactions),a=e.ref(r.blogpost.isReacted),s=e.ref(r.blogpost.reactionId);async function l(m){if(!r.user){alert("Please login to add a reaction");return}try{const n={target:r.blogpost._id,type:"blogpost",user:r.user,class:"like"},p=await b.create(n);p.reaction.class==="like"&&(o.value+=1,a.value=!0,s.value=p.reaction._id)}catch(n){console.error(n),alert("Error adding reaction. Please try again later.")}}async function i(m){if(!r.user){alert("Please login to add a reaction");return}try{const n={_id:s.value};await b.delete(n),o.value-=1,a.value=!1,s.value=null}catch{alert("Error adding reaction. Please try again later.")}}return(m,n)=>(e.openBlock(),e.createElementBlock("footer",A,[e.createTextVNode(" 👁️ "+e.toDisplayString(t.blogpost.views)+" ",1),U,e.createElementVNode("div",M,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"cursor-pointer",onClick:n[0]||(n[0]=p=>l())}," 👍 "+e.toDisplayString(o.value),1)),a.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"cursor-pointer",onClick:n[1]||(n[1]=p=>i())}," 👍 "+e.toDisplayString(o.value),1)):e.createCommentVNode("",!0)]),F,e.createTextVNode(" 💬 "+e.toDisplayString(t.blogpost.numberOfComments),1)]))}},H={class:"bg-grey radius-big"},G=["src"],J={class:"pd-t-zero pd-medium"},K={key:0,class:"cursor-pointer mn-thin flex-nowrap flex w-100"},Q={key:0,class:"pd-micro t-white uppercase t-semi p-small flex-center flex pd-r-small pd-l-small mn-l-thin w-min bg-second radius-extra"},W={key:1,class:"mn-small t-transp p-big"},X={key:2,class:"mn-small h2"},N={__name:"CardBlogpost",props:["blogpost","user","type"],setup(t){const r=t,o=V.useRouter(),a=e.computed(()=>r.blogpost.content.find(l=>l.type==="ImageUpload")),s=e.computed(()=>r.blogpost.content.find(l=>l.type==="Textarea"));return(l,i)=>(e.openBlock(),e.createElementBlock("article",H,[e.createVNode(S._sfc_main,{class:e.normalizeClass({"mn-small pd-medium":t.type!=="short","flex-child-order-last flex-child mn-l-small":t.type==="short"}),owner:t.blogpost.owner,creator:t.blogpost.creator,date:t.blogpost.createdAt},null,8,["class","owner","creator","date"]),e.unref(a)&&e.unref(a).content&&t.type!=="blogpostPage"?(e.openBlock(),e.createElementBlock("img",{key:0,src:e.unref(a).content,alt:"Blog post image",class:"mn-medium object-fit-cover w-100 h-20r"},null,8,G)):e.createCommentVNode("",!0),e.createElementVNode("section",J,[t.type!=="blogpostPage"?(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("h3",{onClick:i[0]||(i[0]=m=>e.unref(o).push({name:"BlogPost",params:{url:t.blogpost.url}})),class:""},e.toDisplayString(t.blogpost.name),1),t.blogpost.status==="draft"?(e.openBlock(),e.createElementBlock("div",Q,e.toDisplayString(t.blogpost.status),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.unref(s)&&e.unref(s).content&&t.type!=="blogpostPage"?(e.openBlock(),e.createElementBlock("p",W,e.toDisplayString(e.unref(s).content.slice(0,120))+"... ",1)):e.createCommentVNode("",!0),t.type==="blogpostPage"?(e.openBlock(),e.createElementBlock("h3",X,e.toDisplayString(t.blogpost.name),1)):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"default")]),e.createVNode(P,{class:"pd-t-zero pd-medium",blogpost:t.blogpost,user:t.user},null,8,["blogpost","user"])]))}},Y={class:"feed"},Z={key:1},ee={__name:"Feed",props:{category:{type:String,default:null},owner:{type:String,default:null},creator:{type:String,default:null},status:{type:String,default:"published"},user:{type:[String,Number],default:null},period:{type:String,default:null}},setup(t){const r=t,o=e.ref([]),a=e.ref(!0);let s=e.ref(!0),l=e.ref(0),i=e.ref(2);const m=async()=>{if(a.value){l.value+=i.value;const n=await k({skip:l.value,limit:i.value,category:r.category,user:r.user,owner:r.owner,status:r.status,creator:r.creator,period:r.period});n.length===0&&(a.value=!1),o.value=[...o.value,...n]}};return e.onMounted(async()=>{const n=await k({skip:l.value,limit:i.value,category:r.category,user:r.user,owner:r.owner,status:r.status,creator:r.creator,period:r.period});n.length===0?a.value=!1:a.value=!0,o.value=n,s.value=!1}),(n,p)=>(e.openBlock(),e.createElementBlock("section",Y,[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[e.unref(s)?(e.openBlock(),e.createBlock(E,{key:0,class:"z-index-5 pos-t-50 left-t-50 pos-absolute"})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[!e.unref(s)&&o.value.length<1?(e.openBlock(),e.createBlock(C._sfc_main,{key:0,title:"No Blog Posts Found",description:"Currently, there are no posts available in this blog. Please check back later.",class:"pd-medium mn-thin bg-grey radius-big"})):(e.openBlock(),e.createElementBlock("div",Z,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,h=>(e.openBlock(),e.createBlock(N,{key:h._id,blogpost:h,user:t.user,class:"mn-medium"},null,8,["blogpost","user"]))),128)),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[a.value&&o.value.length>0?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:m,class:"w-100 bg-main button"}," Load more ")):e.createCommentVNode("",!0)]),_:1})]))]),_:1})]))}};exports.Loader=E;exports._sfc_main=ee;exports._sfc_main$1=N;exports._sfc_main$2=P;exports.blogposts=j;exports.clean=x;exports.create=w;exports.reactions=q;exports.read=k;exports.remove=B;exports.state=c;exports.update=_;