@ozdao/prometheus-framework 0.1.7 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-561d6db3.js +1 -0
  2. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-9e474158.mjs +1945 -0
  3. package/dist/ButtonFollow-38d9a720.mjs +131 -0
  4. package/dist/ButtonFollow-9a33ab06.js +1 -0
  5. package/dist/CardOrganization-3049931d.mjs +230 -0
  6. package/dist/CardOrganization-8b376cbb.js +1 -0
  7. package/dist/Chips-03ff0c34.mjs +108 -0
  8. package/dist/Chips-4d8ac62e.js +1 -0
  9. package/dist/Feed-1d0d9853.js +1 -0
  10. package/dist/Feed-79839e67.mjs +368 -0
  11. package/dist/Feed-af94027c.js +1 -0
  12. package/dist/Feed-b616f102.mjs +439 -0
  13. package/dist/Image-75f5becb.js +9 -0
  14. package/dist/Image-be69af9c.mjs +477 -0
  15. package/dist/Popup-d7dbc670.mjs +76 -0
  16. package/dist/Popup-ee4bd834.js +1 -0
  17. package/dist/Product-8bee8d1c.mjs +838 -0
  18. package/dist/Product-a39f3ca3.js +7 -0
  19. package/dist/ProductEdit-052b0aef.mjs +350 -0
  20. package/dist/ProductEdit-a322f1ba.js +1 -0
  21. package/dist/ProfileBlogposts-08f784c3.mjs +64 -0
  22. package/dist/ProfileBlogposts-d6bba033.js +1 -0
  23. package/dist/ProfileComments-96f6cde8.mjs +44 -0
  24. package/dist/ProfileComments-dd923865.js +1 -0
  25. package/dist/ProfileEvents-1e0c1291.js +1 -0
  26. package/dist/ProfileEvents-26a72fe2.mjs +56 -0
  27. package/dist/ProfileLikes-b1060d1e.js +1 -0
  28. package/dist/ProfileLikes-c8dab14d.mjs +44 -0
  29. package/dist/ProfileOrganizations-3a879480.mjs +212 -0
  30. package/dist/ProfileOrganizations-78fef72e.js +1 -0
  31. package/dist/Publics-8bb9a680.js +1 -0
  32. package/dist/Publics-ffc08ad7.mjs +123 -0
  33. package/dist/UploadImage-6344f789.js +1 -0
  34. package/dist/UploadImage-f04e4bc0.mjs +83 -0
  35. package/dist/auth-60c81f40.mjs +1836 -0
  36. package/dist/auth-e8f6d979.js +8 -0
  37. package/dist/auth.client.cjs +4 -4
  38. package/dist/auth.client.js +247 -236
  39. package/dist/auth.server.js +72 -11
  40. package/dist/auth.server.mjs +72 -11
  41. package/dist/auth.validation-1d5f2990.mjs +20 -0
  42. package/dist/auth.validation-2dfb450f.js +1 -0
  43. package/dist/community.client.cjs +1 -1
  44. package/dist/community.client.js +11 -11
  45. package/dist/events.client.cjs +1 -1
  46. package/dist/events.client.js +9 -9
  47. package/dist/organizations-4157d81d.js +1 -0
  48. package/dist/organizations-52438d24.mjs +121 -0
  49. package/dist/organizations.client-16ee6b43.js +3 -0
  50. package/dist/organizations.client-cdbaf6aa.mjs +3017 -0
  51. package/dist/organizations.client.cjs +1 -1
  52. package/dist/organizations.client.js +11 -11
  53. package/dist/users.client.cjs +1 -1
  54. package/dist/users.client.js +258 -239
  55. package/dist/users.server.js +7 -0
  56. package/dist/users.server.mjs +7 -0
  57. package/package.json +2 -1
  58. package/src/components/CardHeader/CardHeader.vue +2 -1
  59. package/src/modules/auth/components/pages/SignIn.vue +48 -39
  60. package/src/modules/auth/controllers/auth.controller.js +42 -11
  61. package/src/modules/auth/store/auth.js +3 -10
  62. package/src/modules/auth/utils/server/verifyAppleIdToken.js +57 -0
  63. package/src/modules/users/components/pages/Profile.vue +20 -6
  64. package/src/modules/users/components/pages/ProfileEdit.vue +15 -5
  65. package/src/modules/users/models/user.model.js +9 -1
  66. package/src/modules/users/store/users.js +2 -1
@@ -1,40 +1,101 @@
1
1
  "use strict";
2
2
  const _commonjsHelpers = require("./_commonjsHelpers-3b53548e.js");
3
3
  const require$$0 = require("jsonwebtoken");
4
- const require$$1$1 = require("bcryptjs");
5
- const require$$1 = require("mongoose");
4
+ const require$$1$2 = require("bcryptjs");
5
+ const require$$1$1 = require("mongoose");
6
6
  const require$$3 = require("uuidv4");
7
+ const require$$1 = require("node-fetch");
8
+ const require$$2 = require("jwk-to-pem");
7
9
  const mailing = require("./mailing-25d08f4c.js");
8
10
  const index = require("./index-21dfdbd9.js");
9
11
  require("dotenv");
10
12
  require("nodemailer");
11
13
  require("axios");
12
14
  require("mongodb");
15
+ const jwt$1 = require$$0;
16
+ const fetch = require$$1;
17
+ const jwkToPem = require$$2;
18
+ async function verifyAppleIdToken$1(id_token) {
19
+ const decodedToken = jwt$1.decode(id_token, { complete: true });
20
+ if (!decodedToken) {
21
+ throw new Error("Failed to decode token.");
22
+ }
23
+ if (decodedToken.payload.iss !== "https://appleid.apple.com") {
24
+ throw new Error("Invalid issuer.");
25
+ }
26
+ if (decodedToken.payload.aud !== process.env.APPLE_CLIENTID) {
27
+ throw new Error("Invalid audience.");
28
+ }
29
+ const currentTimestamp = Math.floor(Date.now() / 1e3);
30
+ if (currentTimestamp > decodedToken.payload.exp) {
31
+ throw new Error("Token has expired.");
32
+ }
33
+ const applePublicKeys = await fetch("https://appleid.apple.com/auth/keys").then((response) => response.json()).catch((err) => {
34
+ throw new Error("Failed to fetch Apple public keys.");
35
+ });
36
+ const appleKey = applePublicKeys.keys.find((key) => key.kid === decodedToken.header.kid);
37
+ if (!appleKey) {
38
+ throw new Error("Invalid token key ID.");
39
+ }
40
+ const pem = jwkToPem(appleKey);
41
+ try {
42
+ jwt$1.verify(id_token, pem, {
43
+ algorithms: ["RS256"],
44
+ issuer: "https://appleid.apple.com"
45
+ });
46
+ } catch (err) {
47
+ console.log(err);
48
+ throw new Error("Token signature verification failed.");
49
+ }
50
+ return decodedToken.payload;
51
+ }
52
+ var verifyAppleIdToken_1 = { verifyAppleIdToken: verifyAppleIdToken$1 };
13
53
  const jwt = require$$0;
14
- const bcrypt = require$$1$1;
15
- const ObjectId = require$$1.Types.ObjectId;
54
+ const bcrypt = require$$1$2;
55
+ const ObjectId = require$$1$1.Types.ObjectId;
56
+ const { verifyAppleIdToken } = verifyAppleIdToken_1;
16
57
  const controllerFactory$4 = (db) => {
17
58
  const User = db.user;
18
59
  const Membership = db.membership;
19
60
  const Invite = db.invite;
20
61
  const Role = db.role;
21
62
  const signin = async (req, res) => {
22
- const { type, email, phone } = req.body;
63
+ const { type, email, phone, authorization } = req.body;
23
64
  let query;
65
+ let payload = null;
24
66
  if (type === "phone" && phone) {
25
67
  query = { phone };
26
68
  }
27
69
  if (type === "email" && email) {
28
70
  query = { email };
29
71
  }
72
+ if (type === "apple" && authorization.id_token) {
73
+ payload = await verifyAppleIdToken(authorization.id_token);
74
+ if (payload) {
75
+ query = { apple_id: payload.sub };
76
+ } else {
77
+ return res.status(401).send({ errorCode: "INVALID_APPLE_ID_TOKEN" });
78
+ }
79
+ }
30
80
  try {
31
- const user = await User.findOne(query).populate("roles").exec();
32
- if (!user) {
33
- return res.status(404).send({ errorCode: "USER_PHONE_OR_PASSWORD_NOT_FOUND" });
81
+ let user = await User.findOne(query).populate("roles").exec();
82
+ if ((type === "email" || type === "phone") && req.body.password) {
83
+ const passwordIsValid = bcrypt.compareSync(req.body.password, user.password);
84
+ if (!passwordIsValid) {
85
+ return res.status(401).send({ errorCode: "INCORRECT_PASSWORD_ENTERED", accessToken: null });
86
+ }
34
87
  }
35
- const passwordIsValid = bcrypt.compareSync(req.body.password, user.password);
36
- if (!passwordIsValid) {
37
- return res.status(401).send({ errorCode: "INCORRECT_PASSWORD_ENTERED", accessToken: null });
88
+ if (type === "apple" && !user) {
89
+ const { firstName, lastName } = req.body.user.name;
90
+ const newUser = new User({
91
+ apple_id: payload.sub,
92
+ email: payload.email,
93
+ profile: { name: `${firstName} ${lastName}` }
94
+ });
95
+ await newUser.save();
96
+ user = newUser;
97
+ } else if (!user) {
98
+ return res.status(404).send({ errorCode: "USER_NOT_FOUND" });
38
99
  }
39
100
  const memberships = await Membership.findOne({ user: user._id });
40
101
  const token = jwt.sign({
@@ -1,39 +1,100 @@
1
1
  import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-83b1d755.mjs";
2
2
  import require$$0 from "jsonwebtoken";
3
- import require$$1$1 from "bcryptjs";
4
- import require$$1 from "mongoose";
3
+ import require$$1$2 from "bcryptjs";
4
+ import require$$1$1 from "mongoose";
5
5
  import require$$3 from "uuidv4";
6
+ import require$$1 from "node-fetch";
7
+ import require$$2 from "jwk-to-pem";
6
8
  import { m as mailing } from "./mailing-ebc6e90f.mjs";
7
9
  import { s as server } from "./index-fa8d5df4.mjs";
8
10
  import "dotenv";
9
11
  import "nodemailer";
10
12
  import "axios";
11
13
  import "mongodb";
14
+ const jwt$1 = require$$0;
15
+ const fetch = require$$1;
16
+ const jwkToPem = require$$2;
17
+ async function verifyAppleIdToken$1(id_token) {
18
+ const decodedToken = jwt$1.decode(id_token, { complete: true });
19
+ if (!decodedToken) {
20
+ throw new Error("Failed to decode token.");
21
+ }
22
+ if (decodedToken.payload.iss !== "https://appleid.apple.com") {
23
+ throw new Error("Invalid issuer.");
24
+ }
25
+ if (decodedToken.payload.aud !== process.env.APPLE_CLIENTID) {
26
+ throw new Error("Invalid audience.");
27
+ }
28
+ const currentTimestamp = Math.floor(Date.now() / 1e3);
29
+ if (currentTimestamp > decodedToken.payload.exp) {
30
+ throw new Error("Token has expired.");
31
+ }
32
+ const applePublicKeys = await fetch("https://appleid.apple.com/auth/keys").then((response) => response.json()).catch((err) => {
33
+ throw new Error("Failed to fetch Apple public keys.");
34
+ });
35
+ const appleKey = applePublicKeys.keys.find((key) => key.kid === decodedToken.header.kid);
36
+ if (!appleKey) {
37
+ throw new Error("Invalid token key ID.");
38
+ }
39
+ const pem = jwkToPem(appleKey);
40
+ try {
41
+ jwt$1.verify(id_token, pem, {
42
+ algorithms: ["RS256"],
43
+ issuer: "https://appleid.apple.com"
44
+ });
45
+ } catch (err) {
46
+ console.log(err);
47
+ throw new Error("Token signature verification failed.");
48
+ }
49
+ return decodedToken.payload;
50
+ }
51
+ var verifyAppleIdToken_1 = { verifyAppleIdToken: verifyAppleIdToken$1 };
12
52
  const jwt = require$$0;
13
- const bcrypt = require$$1$1;
14
- const ObjectId = require$$1.Types.ObjectId;
53
+ const bcrypt = require$$1$2;
54
+ const ObjectId = require$$1$1.Types.ObjectId;
55
+ const { verifyAppleIdToken } = verifyAppleIdToken_1;
15
56
  const controllerFactory$4 = (db) => {
16
57
  const User = db.user;
17
58
  const Membership = db.membership;
18
59
  const Invite = db.invite;
19
60
  const Role = db.role;
20
61
  const signin = async (req, res) => {
21
- const { type, email, phone } = req.body;
62
+ const { type, email, phone, authorization } = req.body;
22
63
  let query;
64
+ let payload = null;
23
65
  if (type === "phone" && phone) {
24
66
  query = { phone };
25
67
  }
26
68
  if (type === "email" && email) {
27
69
  query = { email };
28
70
  }
71
+ if (type === "apple" && authorization.id_token) {
72
+ payload = await verifyAppleIdToken(authorization.id_token);
73
+ if (payload) {
74
+ query = { apple_id: payload.sub };
75
+ } else {
76
+ return res.status(401).send({ errorCode: "INVALID_APPLE_ID_TOKEN" });
77
+ }
78
+ }
29
79
  try {
30
- const user = await User.findOne(query).populate("roles").exec();
31
- if (!user) {
32
- return res.status(404).send({ errorCode: "USER_PHONE_OR_PASSWORD_NOT_FOUND" });
80
+ let user = await User.findOne(query).populate("roles").exec();
81
+ if ((type === "email" || type === "phone") && req.body.password) {
82
+ const passwordIsValid = bcrypt.compareSync(req.body.password, user.password);
83
+ if (!passwordIsValid) {
84
+ return res.status(401).send({ errorCode: "INCORRECT_PASSWORD_ENTERED", accessToken: null });
85
+ }
33
86
  }
34
- const passwordIsValid = bcrypt.compareSync(req.body.password, user.password);
35
- if (!passwordIsValid) {
36
- return res.status(401).send({ errorCode: "INCORRECT_PASSWORD_ENTERED", accessToken: null });
87
+ if (type === "apple" && !user) {
88
+ const { firstName, lastName } = req.body.user.name;
89
+ const newUser = new User({
90
+ apple_id: payload.sub,
91
+ email: payload.email,
92
+ profile: { name: `${firstName} ${lastName}` }
93
+ });
94
+ await newUser.save();
95
+ user = newUser;
96
+ } else if (!user) {
97
+ return res.status(404).send({ errorCode: "USER_NOT_FOUND" });
37
98
  }
38
99
  const memberships = await Membership.findOne({ user: user._id });
39
100
  const token = jwt.sign({
@@ -0,0 +1,20 @@
1
+ import { useRouter as i } from "vue-router";
2
+ import { s } from "./auth-60c81f40.mjs";
3
+ i();
4
+ function n(r, o, e) {
5
+ e(), s.user.phone = "", s.user.email = "", s.user.password = "", s.user.passwordRepeat = "";
6
+ }
7
+ function f(r, o, e) {
8
+ console.log(s.user), s.user.phone === "" && s.user.email === "" ? e("/auth/signin") : e();
9
+ }
10
+ i();
11
+ function c(r, o, e) {
12
+ if (s.access.status)
13
+ return e("/profile/" + s.user._id);
14
+ e();
15
+ }
16
+ export {
17
+ n as a,
18
+ f as c,
19
+ c as r
20
+ };
@@ -0,0 +1 @@
1
+ "use strict";const u=require("vue-router"),e=require("./auth-e8f6d979.js");u.useRouter();function o(t,r,s){s(),e.state.user.phone="",e.state.user.email="",e.state.user.password="",e.state.user.passwordRepeat=""}function i(t,r,s){console.log(e.state.user),e.state.user.phone===""&&e.state.user.email===""?s("/auth/signin"):s()}u.useRouter();function a(t,r,s){if(e.state.access.status)return s("/profile/"+e.state.user._id);s()}exports.checkUser=i;exports.requiresNoAuth=a;exports.resetUser=o;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),w=require("vue-router"),$=require("./Publics-6b7c97bd.js"),u=require("./Feed-4df9352b.js"),g=require("./auth-b61483ce.js"),x=require("./Image-04944a2f.js"),I=require("./Popup-0b38b537.js"),V=require("./Breadcrumbs.vue_vue_type_style_index_0_lang-6f807eb5.js"),z=require("./organizations-49a10611.js"),D=require("./EmptyState-7658d7d6.js"),P=require("./_plugin-vue_export-helper-f246444f.js"),F=require("vue-i18n");require("./globals-928eb13c.js");require("./CardOrganization-43e80590.js");require("./ButtonFollow-4049a57e.js");require("./Chips-32092a52.js");require("./IconEdit-4cfe2115.js");require("./vue-draggable-next.esm-bundler-80731ae0.js");const O={class:"min-h-100vh pd-thin"},L={class:"mn-thin flex-v-center t-left flex-nowrap flex"},j={class:"flex-v-center flex-nowrap flex t-left"},U=e.createElementVNode("span",{class:""},"Topics for ",-1),A={class:"w-max bg-grey pd-medium radius-big mn-semi flex-nowrap flex"},H={class:""},T={__name:"Community",setup(c){const r=w.useRoute(),n=w.useRouter();return(t,a)=>{const d=e.resolveComponent("router-view");return e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("header",L,[e.createElementVNode("h2",j,[U,e.createVNode($.Select,{options:["today","week","month","year"],select:u.state.filter.period,"onUpdate:select":a[0]||(a[0]=o=>u.state.filter.period=o),placeholder:"Select type",class:"w-max mn-l-small bg-grey pd-thin radius-medium h2 t-center t-black"},null,8,["select"])])]),e.createElementVNode("ul",A,[e.createElementVNode("li",{class:e.normalizeClass([{"t-white bg-black":e.unref(r).params.category==="featured"},"mn-r-small t-medium pd-small radius-small"]),onClick:a[1]||(a[1]=o=>e.unref(n).push({name:"Blog"}))},"👑 Featured",2),e.createElementVNode("li",{class:e.normalizeClass([{"t-white bg-black":e.unref(r).params.category==="popular"},"mn-r-small t-medium pd-small radius-small"]),onClick:a[2]||(a[2]=o=>e.unref(n).push({name:"Blog",params:{category:"popular"}}))},"🔥 Popular",2),e.createElementVNode("li",{class:e.normalizeClass([{"t-white bg-black":e.unref(r).params.category==="new"},"mn-r-small t-medium pd-small radius-small"]),onClick:a[3]||(a[3]=o=>e.unref(n).push({name:"Blog",params:{category:"new"}}))},"🆕 New",2),g.state.user._id?(e.openBlock(),e.createElementBlock("li",{key:0,class:e.normalizeClass([{"t-white bg-black":e.unref(r).params.category==="following"},"t-medium pd-small radius-small"]),onClick:a[4]||(a[4]=o=>e.unref(n).push({name:"Blog",params:{category:"following"}}))},"👥 Following",2)):e.createCommentVNode("",!0)]),e.createElementVNode("section",H,[e.createVNode(d,null,{default:e.withCtx(({Component:o,route:m})=>[e.createVNode(e.Transition,{name:"scaleIn",mode:"out-in"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o),{ref:"page",key:m.query}))]),_:2},1024)]),_:1})])])}}},R={class:"pd-thin"},J={key:0,class:"h-100 w-100 bg-grey pd-big radius-big"},G={class:"w-full h-full"},Q={key:1,class:"pd-thin pos-fixed pos-l-0 pos-b-0 w-100"},W={class:"pd-thin radius-big bg-main w-100 flex-nowrap flex"},K={class:"w-m-66r t-left pd-big bg-white radius-big"},X=e.createElementVNode("h3",{class:"mn-small"},"Final Touches",-1),Y=e.createElementVNode("h5",{class:"mn-thin"},"Add to public:",-1),Z={key:0,class:"mn-thin"},ee={key:1,class:"mn-medium br-grey br-2px br-solid pd-small radius-big"},S={__name:"CreateBlogPost",setup(c){const r=w.useRoute(),n=w.useRouter();let t=e.ref(null),a=e.ref(null);const d=e.ref([]),o=e.ref(null);e.onMounted(async()=>{if(r.params.url){const i=await u.read({user:g.state.user._id,url:r.params.url});t.value=i.pop()}else u.clean(),t.value=u.state.current;t.value.owner||(t.value.owner={target:g.state.user._id,type:"user"}),t.value.creator||(t.value.creator={target:g.state.user._id,type:"user",hidden:!1}),t.value.owner.type==="organization"&&(o.value={_id:t.value.owner.target._id,name:t.value.owner.target.profile.name,photo:t.value.owner.target.profile.photo});const l=await z.actions.read({user:g.state.user._id,postable:g.state.user._id,limit:100});console.log(l),a.value=l.map(i=>({name:i.profile.name,_id:i._id,photo:i.profile.photo}))});const m=e.ref(""),s=e.ref([{text:"story"},{text:"news"},{text:"guide"},{text:"discussion"},{text:"photos"}]);e.computed(()=>s.value.filter(l=>l.text.toLowerCase().includes(m.value.toLowerCase()))),e.computed(()=>s.value.filter(l=>!d.value.some(i=>i.text===l.text)));const p=e.ref(!1);function b(){p.value=!0}function v(){p.value=!1}function k(){d.value.length>0&&d.value.map(l=>l.text),t.value.status="draft",r.params.url?u.update(t.value).then(l=>{n.push({name:"BlogPost",params:{url:l.url}})}).catch(l=>{console.log(l)}):u.create(t.value).then(l=>{n.push({name:"BlogPost",params:{url:l.url}})}).catch(l=>{console.log(l)})}function B(){o.value&&(t.value.owner={target:o.value._id,type:"organization"}),o.value||(t.value.creator.hidden=!1),o.value||(t.value.organization=t.value.creator),t.value.status="published",console.log(t.value),r.params.url?u.update(t.value).then(l=>{n.push({name:"BlogPost",params:{url:l.url}})}).catch(l=>{console.log(l)}):u.create(t.value).then(l=>{n.push({name:"BlogPost",params:{url:l.url}})}).catch(l=>{console.log(l)})}function N(){confirm("Are you sure you want to delete this post?")&&u.remove(t.value._id).then(l=>{n.push({name:"User Blogposts",params:{_id:t.value.creator.target._id}})}).catch(l=>{console.log(l)})}return(l,i)=>(e.openBlock(),e.createElementBlock("article",R,[e.unref(t)?(e.openBlock(),e.createElementBlock("section",J,[e.createElementVNode("div",G,[e.createVNode(x._sfc_main,{prop:e.unref(t),content:"name",placeholder:"Enter post title",class:"h2"},null,8,["prop"])]),e.createVNode(x._sfc_main$1,{content:e.unref(t).content,onUpdate:i[0]||(i[0]=_=>e.unref(t).content=_)},null,8,["content"])])):e.createCommentVNode("",!0),e.unref(t)?(e.openBlock(),e.createElementBlock("section",Q,[e.createElementVNode("div",W,[e.unref(r).params.url?(e.openBlock(),e.createElementBlock("a",{key:0,onClick:i[1]||(i[1]=_=>N()),class:"mn-r-auto bg-red t-white t-black button"},"Delete")):e.createCommentVNode("",!0),e.createElementVNode("a",{onClick:i[2]||(i[2]=_=>k()),class:"mn-l-auto bg-white t-black button"},"To Drafts"),e.createElementVNode("a",{onClick:i[3]||(i[3]=_=>b()),class:"mn-l-thin bg-black t-white button"},"Publish")])])):e.createCommentVNode("",!0),e.createVNode(I._sfc_main,{title:"Добавить участника",onClosePopup:v,isPopupOpen:p.value},{default:e.withCtx(()=>[e.createElementVNode("div",K,[X,e.createVNode(V._sfc_main,{onTagsChanged:i[4]||(i[4]=_=>e.unref(t).tags=_),tags:e.unref(t).tags},null,8,["tags"]),Y,e.createVNode(V.SelectMulti,{modelValue:o.value,"onUpdate:modelValue":i[5]||(i[5]=_=>o.value=_),options:e.unref(a),multiple:!1,taggable:!1,placeholder:"Type to search or add tag",label:"name","track-by":"_id",class:"mn-medium bg-grey radius-medium pd-small"},null,8,["modelValue","options"]),o.value?(e.openBlock(),e.createElementBlock("h5",Z,"Options:")):e.createCommentVNode("",!0),o.value?(e.openBlock(),e.createElementBlock("div",ee,[e.createVNode(V.Checkbox,{label:"Hide Author",radio:e.unref(t).creator.hidden,"onUpdate:radio":i[6]||(i[6]=_=>e.unref(t).creator.hidden=_),name:"prices",class:"w-100"},null,8,["radio"])])):e.createCommentVNode("",!0),e.createVNode(g._sfc_main,{submit:B,callback:l.redirectTo,class:"w-100 bg-black t-white"},{default:e.withCtx(()=>[e.createTextVNode("Publish")]),_:1},8,["callback"])])]),_:1},8,["isPopupOpen"])]))}},C=Object.freeze(Object.defineProperty({__proto__:null,default:S},Symbol.toStringTag,{value:"Module"})),te={},oe={width:"100%",height:"20rem",xmlns:"http://www.w3.org/2000/svg"},ne=e.createStaticVNode('<rect x="0" y="0" rx="5" ry="5" width="100%" height="100%" fill="rgb(var(--grey))"></rect><rect x="15" y="15" rx="4" ry="4" width="40%" height="20" fill="rgba(var(--black),0.05)"></rect><rect x="15" y="45" rx="5" ry="5" width="70%" height="50" fill="rgba(var(--black),0.05)"></rect><rect x="15" y="110" rx="3" ry="3" width="90%" height="6" fill="rgba(var(--black),0.05)"></rect><rect x="15" y="130" rx="3" ry="3" width="70%" height="6" fill="rgba(var(--black),0.05)"></rect><rect x="-25%" y="0" width="25%" height="100%" fill="#fff" mask="url(#myMask)" opacity="0.3"><animate attributeName="x" from="-25%" to="100%" dur="2s" repeatCount="indefinite"></animate></rect>',6),ae=[ne];function re(c,r){return e.openBlock(),e.createElementBlock("svg",oe,ae)}const se=P._export_sfc(te,[["render",re]]),le={class:"pd-thin"},q={__name:"BlogPost",setup(c){const r=w.useRoute(),n=e.ref(null),t=e.ref(!0);e.onMounted(async()=>{t.value=!0;const o=await u.read({user:g.state.user._id,url:r.params.url});n.value=o[0],t.value=!1});const a={Textarea:"p",H2:"h2",Bullets:"p",Caption:"p",ImageUpload:x._sfc_main$3};function d(o){return o.type==="Textarea"?{innerHTML:o.content,class:"p-medium"}:o.type==="H2"?{innerHTML:o.content,class:"h3"}:o.type==="Caption"?{innerHTML:o.content}:o.type==="ImageUpload"?{src:o.content}:{}}return(o,m)=>(e.openBlock(),e.createElementBlock("section",le,[e.createVNode(e.TransitionGroup,{tag:"ul",name:"fade",class:"o-hidden bg-grey radius-big"},{default:e.withCtx(()=>[t.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},e.renderList(3,s=>e.createVNode(se,{key:s})),64)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[!t.value&&!n.value?(e.openBlock(),e.createBlock(D._sfc_main,{key:0,title:"No Blogpost Found",description:"Currently, there are no blogposts available. Please check back later.",class:"pd-medium mn-thin bg-grey radius-big"})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.TransitionGroup,{tag:"ul",name:"fade",class:"container"},{default:e.withCtx(()=>[!t.value&&n.value?(e.openBlock(),e.createBlock(u._sfc_main$1,{key:0,onClick:m[0]||(m[0]=s=>o.$router.push({name:"Blogpost",params:{url:n.value.url}})),blogpost:n.value,user:g.state.user._id,type:"blogpostPage",class:e.normalizeClass(["mn-medium",{"br-b br-solid br-black-transp-10":o.index!==n.value.length-1}])},{default:e.withCtx(()=>[e.createElementVNode("section",null,[n.value&&n.value.content?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.value.content,(s,p)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a[s.type]),e.mergeProps({key:p,index:p,component:s,prop:s,class:s.class,content:"content"},d(s),{class:"mn-regular"}),null,16,["index","component","prop","class"]))),128)):e.createCommentVNode("",!0)])]),_:1},8,["blogpost","user","class"])):e.createCommentVNode("",!0),e.createVNode($._sfc_main,{class:"mn-small"}),!t.value&&n.value?(e.openBlock(),e.createBlock(x._sfc_main$2,{key:1,type:"blogpost",target:n.value._id,owner:g.state.user._id},null,8,["target","owner"])):e.createCommentVNode("",!0)]),_:1})]))}},ie=Object.freeze(Object.defineProperty({__proto__:null,default:q},Symbol.toStringTag,{value:"Module"})),M={__name:"Blog",setup(c){const r=w.useRoute(),n=w.useRouter();return r.params.category||(r.params.category="featured"),e.onMounted(()=>{if(r.query){const t=r.query,a={tags:t.tags?t.tags.split(","):[],period:t.period?t.period:"week"};u.state.filter=a}}),e.watch(()=>u.state.filter,(t,a)=>{const d={...r.query};Object.keys(a).forEach(m=>{d[m]&&delete d[m]});const o=Object.fromEntries(Object.entries(t).filter(([m,s])=>Array.isArray(s)&&s.length>0||typeof s=="string"&&s).map(([m,s])=>[m,Array.isArray(s)?s.join(","):s]));Object.assign(d,o),n.replace({query:d})},{deep:!0}),(t,a)=>(e.openBlock(),e.createElementBlock("section",null,[e.createVNode(u._sfc_main,{category:e.unref(r).params.category,user:g.state.user._id,period:e.unref(r).query.period},null,8,["category","user","period"])]))}},ce=Object.freeze(Object.defineProperty({__proto__:null,default:M},Symbol.toStringTag,{value:"Module"})),ue={class:"w-100 cols-4 t-left flex-nowrap flex"},de={key:0,class:"w-100 br-2px br-solid br-white-transp-10 radius-small pd-small flex-v-center flex-nowrap flex"},me=e.createElementVNode("p",{class:"h4 i-medium mn-r-small"},"👍",-1),pe={class:"t-semi uppercase"},ge=e.createElementVNode("br",null,null,-1),_e={key:1,class:"w-100 br-2px br-solid br-white-transp-10 radius-small pd-small flex-v-center flex-nowrap flex"},fe=e.createElementVNode("p",{class:"h4 i-medium mn-r-small"},"💬",-1),he={class:"t-semi uppercase"},ve=e.createElementVNode("br",null,null,-1),be={key:2,class:"w-100 br-2px br-solid br-white-transp-10 radius-small pd-small flex-v-center flex-nowrap flex"},ye=e.createElementVNode("p",{class:"h4 i-medium mn-r-small"},"👍",-1),we={class:"t-semi uppercase"},ke=e.createElementVNode("br",null,null,-1),xe={__name:"Activity",props:{likes:Number,comments:Number,subscriptions:Number},setup(c){return(r,n)=>(e.openBlock(),e.createElementBlock("section",ue,[c.likes?(e.openBlock(),e.createElementBlock("div",de,[me,e.createElementVNode("span",pe,[e.createTextVNode(e.toDisplayString(c.likes),1),ge,e.createTextVNode("likes")])])):e.createCommentVNode("",!0),c.comments?(e.openBlock(),e.createElementBlock("div",_e,[fe,e.createElementVNode("span",he,[e.createTextVNode(e.toDisplayString(c.comments),1),ve,e.createTextVNode("comments")])])):e.createCommentVNode("",!0),c.subscriptions?(e.openBlock(),e.createElementBlock("div",be,[ye,e.createElementVNode("span",we,[e.createTextVNode(e.toDisplayString(c.subscriptions),1),ke,e.createTextVNode("subscriptions")])])):e.createCommentVNode("",!0)]))}},Be={class:"pd-thin radius-extra flex-nowrap flex"},Ne=["innerHTML"],Ve={__name:"FieldBig",props:{input:String,placeholder:{type:String},action:{type:String,default:"Action"},placeholderTexts:{type:Object,default:()=>({en:["First placeholder","Second placeholder","Third placeholder"],ru:["Первый плейсхолдер","Второй плейсхолдер","Третий плейсхолдер"]})},typingSpeed:{type:Number,default:200},loopTyping:{type:Boolean,default:!1},enableTyping:{type:Boolean,default:!1}},emits:["update:input","action"],setup(c,{emit:r}){const n=c,{t,locale:a}=F.useI18n();let d=e.ref(0),o=e.ref(n.input),m=e.ref(n.placeholder),s=e.ref(n.enableTyping),p=e.ref(null),b=e.ref(""),v=e.ref(!0),k=null;function B(){r("action")}function N(h){r("update:input",h),b.value=h}function l(){d.value=(d.value+1)%n.placeholderTexts[a.value].length}function i(){s.value=!1,clearInterval(p.value),m.value=n.placeholder,b.value||(o.value="")}function _(){!b.value&&n.enableTyping&&(s.value=!0,m.value="",E())}function E(){let h=n.placeholderTexts[a.value][d.value],f=0,y=!1;k=setInterval(()=>{v.value=!v.value},200),p.value=setInterval(()=>{s.value&&(y?(o.value=o.value.slice(0,-1),o.value=h.substring(0,f)+(v.value&&f%2?"|":""),f--):(o.value=h.substring(0,f)+(v.value&&f%2?"|":""),f++),f>h.length&&n.loopTyping&&setTimeout(()=>{y=!0,o.value=h.substring(0,f)},333),f===0&&y&&(y=!1,l(),h=n.placeholderTexts[a.value][d.value]))},n.typingSpeed)}return e.onMounted(()=>{n.enableTyping&&E()}),e.watchEffect(()=>{s.value||(clearInterval(p.value),clearInterval(k))}),(h,f)=>(e.openBlock(),e.createElementBlock("div",Be,[e.createVNode(g.Field,{field:e.unref(o),"onUpdate:field":[f[0]||(f[0]=y=>e.isRef(o)?o.value=y:o=y),N],placeholder:e.unref(m),onInput:l,onFocus:i,onBlur:_,class:"w-100 pd-small p-big"},null,8,["field","placeholder"]),c.action?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:B,class:"w-min hover_bg-white hover-t-black t-black bg-main button",innerHTML:c.action},null,8,Ne)):e.createCommentVNode("",!0)]))}};const Ee={class:"pd-thin"},Ce={class:"o-hidden t-black bg-main pd-big radius-big"},$e=e.createElementVNode("header",{class:"t-center z-index-1 mn-big"},[e.createElementVNode("h2",{class:"mn-l-auto mn-r-auto w-m-40r mn-medium"},"Stay Updated with The Latest in Cannabis."),e.createElementVNode("p",{class:"t-transp p-big"},"Subscribe to our newsletter for news, insights, and more from the Weeder universe.")],-1),Pe={class:"z-index-1 mn-big w-100 flex-nowrap flex"},Te=e.createElementVNode("div",{class:"w-100 h-100 pos-absolute pos-t-50-negative pos-r-0 z-index-0 grid"},[e.createElementVNode("div",{class:"spiral"})],-1),Se={__name:"SubscribeNewsletter",setup(c){let r=e.ref("");return(n,t)=>(e.openBlock(),e.createElementBlock("section",Ee,[e.createElementVNode("div",Ce,[$e,e.createElementVNode("div",Pe,[e.createVNode(Ve,{input:e.unref(r),typingSpeed:75,loopTyping:!1,enableTyping:!1,placeholder:"Please enter your email",action:"Subscribe","onUpdate:input":t[0]||(t[0]=a=>e.isRef(r)?r.value=a:r=a),onAction:t[1]||(t[1]=a=>n.router.push({name:"Product Recommmendation",query:{mood:n.mood}})),class:"mn-l-auto mn-r-auto bg-white t-black w-50"},null,8,["input"])]),Te])]))}};const qe={class:"container container-joinus"},Me={class:"content"},Ie={class:"h0 mn-big"},ze=e.createElementVNode("p",{class:"w-m-33r t-center mn-small p-big"},"Together, we're shaping the future of the globals cannabis community.",-1),De=e.createElementVNode("button",{class:"bg-black t-white button"},"Join Now",-1),Fe={__name:"JoinUs",setup(c){const r=e.ref(120950),n=e.ref(["/assets/images/reviews/01.png","/assets/images/reviews/02.png","/assets/images/reviews/03.png","/assets/images/reviews/04.png","/assets/images/reviews/05.png","/assets/images/reviews/06.png"]),t=()=>{setInterval(()=>{r.value+=Math.floor(Math.random()*5)+1},330)},a={minSize:"6rem",maxSize:"10rem",minDuration:5,maxDuration:15,spawnPoints:[10,90]};e.onMounted(()=>{d(),t()});const d=()=>{n.value.forEach((o,m)=>{let s=document.createElement("img");s.src=o,s.classList.add("floating-image");let p=a.spawnPoints[Math.floor(Math.random()*a.spawnPoints.length)],b=(Math.random()-.5)*2*10;s.style.left=`${p+b}%`,s.style.animationDuration=`${Math.random()*(a.maxDuration-a.minDuration)+a.minDuration}s`,document.querySelector(".container").appendChild(s),s.addEventListener("animationiteration",()=>{const v=a.spawnPoints[Math.floor(Math.random()*a.spawnPoints.length)],k=(Math.random()-.5)*2*10;s.style.left=`${v+k}%`})})};return(o,m)=>(e.openBlock(),e.createElementBlock("div",qe,[e.createElementVNode("div",Me,[e.createElementVNode("span",Ie,e.toDisplayString(r.value.toLocaleString()),1),ze,De])]))}};const Oe=c=>(e.pushScopeId("data-v-18db0d1b"),c=c(),e.popScopeId(),c),Le={class:"community-feed"},je=Oe(()=>e.createElementVNode("h2",{class:"w-m-75r mn-auto pd-t-big pd-b-big t-center"},"Discover the Vibrant Community",-1)),Ue={class:"grid-container"},Ae={__name:"HotPosts",async setup(c){let r,n;const t=e.ref([]),a=async()=>{const o=await u.read({skip:0,limit:7,period:"year"});console.log(o),t.value=o};[r,n]=e.withAsyncContext(()=>a()),await r,n();const d=o=>{switch(o){case 0:return"grid-item-2x2";case 1:return"grid-item-2x1";case 2:return"grid-item-1x1";case 3:case 4:return"grid-item-1x1";case 6:return"grid-item-2x1";default:return""}};return(o,m)=>(e.openBlock(),e.createElementBlock("section",Le,[je,e.createElementVNode("div",Ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(s,p)=>(e.openBlock(),e.createBlock(u._sfc_main$1,{blogpost:s,owner:g.state.user._id,key:p,class:e.normalizeClass(d(p))},null,8,["blogpost","owner","class"]))),128))])]))}},He=P._export_sfc(Ae,[["__scopeId","data-v-18db0d1b"]]),Re=[{path:"community",component:T,meta:{title:{en:"Community",ru:"Коммьюнити"},title_hide:!0},children:[{path:":category?",name:"Blog",meta:{title:{en:"Community",ru:"Коммьюнити"},title_hide:!0},component:()=>Promise.resolve().then(()=>ce)}]},{path:"community/posts/create",name:"Create BlogPost",meta:{title:{en:"Create Post",ru:"Создать Пост"},authorize:[]},component:()=>Promise.resolve().then(()=>C)},{path:"community/posts/:url",name:"BlogPost",meta:{title:{en:"Post",ru:"Пост"}},component:()=>Promise.resolve().then(()=>ie)},{path:"community/posts/:url/edit",name:"Edit BlogPost",meta:{title:{en:"Edit Post",ru:"Редактировать пост"},authorize:[]},component:()=>Promise.resolve().then(()=>C)}];exports.CardBlogpost=u._sfc_main$1;exports.Feed=u._sfc_main;exports.FooterBlogpost=u._sfc_main$2;exports.blogpostsStore=u.blogposts;exports.reactionsStore=u.reactions;exports.Comments=x._sfc_main$2;exports.Activity=xe;exports.Blog=M;exports.BlogPost=q;exports.Community=T;exports.CreateBlogPost=S;exports.HotPosts=He;exports.JoinUs=Fe;exports.SubscribeNewsletter=Se;exports.blogpostsRoutes=Re;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),w=require("vue-router"),$=require("./Publics-8bb9a680.js"),u=require("./Feed-af94027c.js"),g=require("./auth-e8f6d979.js"),x=require("./Image-75f5becb.js"),I=require("./Popup-ee4bd834.js"),V=require("./Breadcrumbs.vue_vue_type_style_index_0_lang-561d6db3.js"),z=require("./organizations-4157d81d.js"),D=require("./EmptyState-7658d7d6.js"),P=require("./_plugin-vue_export-helper-f246444f.js"),F=require("vue-i18n");require("./globals-928eb13c.js");require("./CardOrganization-8b376cbb.js");require("./ButtonFollow-9a33ab06.js");require("./Chips-4d8ac62e.js");require("./IconEdit-4cfe2115.js");require("./vue-draggable-next.esm-bundler-80731ae0.js");const O={class:"min-h-100vh pd-thin"},L={class:"mn-thin flex-v-center t-left flex-nowrap flex"},j={class:"flex-v-center flex-nowrap flex t-left"},U=e.createElementVNode("span",{class:""},"Topics for ",-1),A={class:"w-max bg-grey pd-medium radius-big mn-semi flex-nowrap flex"},H={class:""},T={__name:"Community",setup(c){const r=w.useRoute(),n=w.useRouter();return(t,a)=>{const d=e.resolveComponent("router-view");return e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("header",L,[e.createElementVNode("h2",j,[U,e.createVNode($.Select,{options:["today","week","month","year"],select:u.state.filter.period,"onUpdate:select":a[0]||(a[0]=o=>u.state.filter.period=o),placeholder:"Select type",class:"w-max mn-l-small bg-grey pd-thin radius-medium h2 t-center t-black"},null,8,["select"])])]),e.createElementVNode("ul",A,[e.createElementVNode("li",{class:e.normalizeClass([{"t-white bg-black":e.unref(r).params.category==="featured"},"mn-r-small t-medium pd-small radius-small"]),onClick:a[1]||(a[1]=o=>e.unref(n).push({name:"Blog"}))},"👑 Featured",2),e.createElementVNode("li",{class:e.normalizeClass([{"t-white bg-black":e.unref(r).params.category==="popular"},"mn-r-small t-medium pd-small radius-small"]),onClick:a[2]||(a[2]=o=>e.unref(n).push({name:"Blog",params:{category:"popular"}}))},"🔥 Popular",2),e.createElementVNode("li",{class:e.normalizeClass([{"t-white bg-black":e.unref(r).params.category==="new"},"mn-r-small t-medium pd-small radius-small"]),onClick:a[3]||(a[3]=o=>e.unref(n).push({name:"Blog",params:{category:"new"}}))},"🆕 New",2),g.state.user._id?(e.openBlock(),e.createElementBlock("li",{key:0,class:e.normalizeClass([{"t-white bg-black":e.unref(r).params.category==="following"},"t-medium pd-small radius-small"]),onClick:a[4]||(a[4]=o=>e.unref(n).push({name:"Blog",params:{category:"following"}}))},"👥 Following",2)):e.createCommentVNode("",!0)]),e.createElementVNode("section",H,[e.createVNode(d,null,{default:e.withCtx(({Component:o,route:m})=>[e.createVNode(e.Transition,{name:"scaleIn",mode:"out-in"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o),{ref:"page",key:m.query}))]),_:2},1024)]),_:1})])])}}},R={class:"pd-thin"},J={key:0,class:"h-100 w-100 bg-grey pd-big radius-big"},G={class:"w-full h-full"},Q={key:1,class:"pd-thin pos-fixed pos-l-0 pos-b-0 w-100"},W={class:"pd-thin radius-big bg-main w-100 flex-nowrap flex"},K={class:"w-m-66r t-left pd-big bg-white radius-big"},X=e.createElementVNode("h3",{class:"mn-small"},"Final Touches",-1),Y=e.createElementVNode("h5",{class:"mn-thin"},"Add to public:",-1),Z={key:0,class:"mn-thin"},ee={key:1,class:"mn-medium br-grey br-2px br-solid pd-small radius-big"},S={__name:"CreateBlogPost",setup(c){const r=w.useRoute(),n=w.useRouter();let t=e.ref(null),a=e.ref(null);const d=e.ref([]),o=e.ref(null);e.onMounted(async()=>{if(r.params.url){const i=await u.read({user:g.state.user._id,url:r.params.url});t.value=i.pop()}else u.clean(),t.value=u.state.current;t.value.owner||(t.value.owner={target:g.state.user._id,type:"user"}),t.value.creator||(t.value.creator={target:g.state.user._id,type:"user",hidden:!1}),t.value.owner.type==="organization"&&(o.value={_id:t.value.owner.target._id,name:t.value.owner.target.profile.name,photo:t.value.owner.target.profile.photo});const l=await z.actions.read({user:g.state.user._id,postable:g.state.user._id,limit:100});console.log(l),a.value=l.map(i=>({name:i.profile.name,_id:i._id,photo:i.profile.photo}))});const m=e.ref(""),s=e.ref([{text:"story"},{text:"news"},{text:"guide"},{text:"discussion"},{text:"photos"}]);e.computed(()=>s.value.filter(l=>l.text.toLowerCase().includes(m.value.toLowerCase()))),e.computed(()=>s.value.filter(l=>!d.value.some(i=>i.text===l.text)));const p=e.ref(!1);function b(){p.value=!0}function v(){p.value=!1}function k(){d.value.length>0&&d.value.map(l=>l.text),t.value.status="draft",r.params.url?u.update(t.value).then(l=>{n.push({name:"BlogPost",params:{url:l.url}})}).catch(l=>{console.log(l)}):u.create(t.value).then(l=>{n.push({name:"BlogPost",params:{url:l.url}})}).catch(l=>{console.log(l)})}function B(){o.value&&(t.value.owner={target:o.value._id,type:"organization"}),o.value||(t.value.creator.hidden=!1),o.value||(t.value.organization=t.value.creator),t.value.status="published",console.log(t.value),r.params.url?u.update(t.value).then(l=>{n.push({name:"BlogPost",params:{url:l.url}})}).catch(l=>{console.log(l)}):u.create(t.value).then(l=>{n.push({name:"BlogPost",params:{url:l.url}})}).catch(l=>{console.log(l)})}function N(){confirm("Are you sure you want to delete this post?")&&u.remove(t.value._id).then(l=>{n.push({name:"User Blogposts",params:{_id:t.value.creator.target._id}})}).catch(l=>{console.log(l)})}return(l,i)=>(e.openBlock(),e.createElementBlock("article",R,[e.unref(t)?(e.openBlock(),e.createElementBlock("section",J,[e.createElementVNode("div",G,[e.createVNode(x._sfc_main,{prop:e.unref(t),content:"name",placeholder:"Enter post title",class:"h2"},null,8,["prop"])]),e.createVNode(x._sfc_main$1,{content:e.unref(t).content,onUpdate:i[0]||(i[0]=_=>e.unref(t).content=_)},null,8,["content"])])):e.createCommentVNode("",!0),e.unref(t)?(e.openBlock(),e.createElementBlock("section",Q,[e.createElementVNode("div",W,[e.unref(r).params.url?(e.openBlock(),e.createElementBlock("a",{key:0,onClick:i[1]||(i[1]=_=>N()),class:"mn-r-auto bg-red t-white t-black button"},"Delete")):e.createCommentVNode("",!0),e.createElementVNode("a",{onClick:i[2]||(i[2]=_=>k()),class:"mn-l-auto bg-white t-black button"},"To Drafts"),e.createElementVNode("a",{onClick:i[3]||(i[3]=_=>b()),class:"mn-l-thin bg-black t-white button"},"Publish")])])):e.createCommentVNode("",!0),e.createVNode(I._sfc_main,{title:"Добавить участника",onClosePopup:v,isPopupOpen:p.value},{default:e.withCtx(()=>[e.createElementVNode("div",K,[X,e.createVNode(V._sfc_main,{onTagsChanged:i[4]||(i[4]=_=>e.unref(t).tags=_),tags:e.unref(t).tags},null,8,["tags"]),Y,e.createVNode(V.SelectMulti,{modelValue:o.value,"onUpdate:modelValue":i[5]||(i[5]=_=>o.value=_),options:e.unref(a),multiple:!1,taggable:!1,placeholder:"Type to search or add tag",label:"name","track-by":"_id",class:"mn-medium bg-grey radius-medium pd-small"},null,8,["modelValue","options"]),o.value?(e.openBlock(),e.createElementBlock("h5",Z,"Options:")):e.createCommentVNode("",!0),o.value?(e.openBlock(),e.createElementBlock("div",ee,[e.createVNode(V.Checkbox,{label:"Hide Author",radio:e.unref(t).creator.hidden,"onUpdate:radio":i[6]||(i[6]=_=>e.unref(t).creator.hidden=_),name:"prices",class:"w-100"},null,8,["radio"])])):e.createCommentVNode("",!0),e.createVNode(g._sfc_main,{submit:B,callback:l.redirectTo,class:"w-100 bg-black t-white"},{default:e.withCtx(()=>[e.createTextVNode("Publish")]),_:1},8,["callback"])])]),_:1},8,["isPopupOpen"])]))}},C=Object.freeze(Object.defineProperty({__proto__:null,default:S},Symbol.toStringTag,{value:"Module"})),te={},oe={width:"100%",height:"20rem",xmlns:"http://www.w3.org/2000/svg"},ne=e.createStaticVNode('<rect x="0" y="0" rx="5" ry="5" width="100%" height="100%" fill="rgb(var(--grey))"></rect><rect x="15" y="15" rx="4" ry="4" width="40%" height="20" fill="rgba(var(--black),0.05)"></rect><rect x="15" y="45" rx="5" ry="5" width="70%" height="50" fill="rgba(var(--black),0.05)"></rect><rect x="15" y="110" rx="3" ry="3" width="90%" height="6" fill="rgba(var(--black),0.05)"></rect><rect x="15" y="130" rx="3" ry="3" width="70%" height="6" fill="rgba(var(--black),0.05)"></rect><rect x="-25%" y="0" width="25%" height="100%" fill="#fff" mask="url(#myMask)" opacity="0.3"><animate attributeName="x" from="-25%" to="100%" dur="2s" repeatCount="indefinite"></animate></rect>',6),ae=[ne];function re(c,r){return e.openBlock(),e.createElementBlock("svg",oe,ae)}const se=P._export_sfc(te,[["render",re]]),le={class:"pd-thin"},q={__name:"BlogPost",setup(c){const r=w.useRoute(),n=e.ref(null),t=e.ref(!0);e.onMounted(async()=>{t.value=!0;const o=await u.read({user:g.state.user._id,url:r.params.url});n.value=o[0],t.value=!1});const a={Textarea:"p",H2:"h2",Bullets:"p",Caption:"p",ImageUpload:x._sfc_main$3};function d(o){return o.type==="Textarea"?{innerHTML:o.content,class:"p-medium"}:o.type==="H2"?{innerHTML:o.content,class:"h3"}:o.type==="Caption"?{innerHTML:o.content}:o.type==="ImageUpload"?{src:o.content}:{}}return(o,m)=>(e.openBlock(),e.createElementBlock("section",le,[e.createVNode(e.TransitionGroup,{tag:"ul",name:"fade",class:"o-hidden bg-grey radius-big"},{default:e.withCtx(()=>[t.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},e.renderList(3,s=>e.createVNode(se,{key:s})),64)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[!t.value&&!n.value?(e.openBlock(),e.createBlock(D._sfc_main,{key:0,title:"No Blogpost Found",description:"Currently, there are no blogposts available. Please check back later.",class:"pd-medium mn-thin bg-grey radius-big"})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.TransitionGroup,{tag:"ul",name:"fade",class:"container"},{default:e.withCtx(()=>[!t.value&&n.value?(e.openBlock(),e.createBlock(u._sfc_main$1,{key:0,onClick:m[0]||(m[0]=s=>o.$router.push({name:"Blogpost",params:{url:n.value.url}})),blogpost:n.value,user:g.state.user._id,type:"blogpostPage",class:e.normalizeClass(["mn-medium",{"br-b br-solid br-black-transp-10":o.index!==n.value.length-1}])},{default:e.withCtx(()=>[e.createElementVNode("section",null,[n.value&&n.value.content?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.value.content,(s,p)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a[s.type]),e.mergeProps({key:p,index:p,component:s,prop:s,class:s.class,content:"content"},d(s),{class:"mn-regular"}),null,16,["index","component","prop","class"]))),128)):e.createCommentVNode("",!0)])]),_:1},8,["blogpost","user","class"])):e.createCommentVNode("",!0),e.createVNode($._sfc_main,{class:"mn-small"}),!t.value&&n.value?(e.openBlock(),e.createBlock(x._sfc_main$2,{key:1,type:"blogpost",target:n.value._id,owner:g.state.user._id},null,8,["target","owner"])):e.createCommentVNode("",!0)]),_:1})]))}},ie=Object.freeze(Object.defineProperty({__proto__:null,default:q},Symbol.toStringTag,{value:"Module"})),M={__name:"Blog",setup(c){const r=w.useRoute(),n=w.useRouter();return r.params.category||(r.params.category="featured"),e.onMounted(()=>{if(r.query){const t=r.query,a={tags:t.tags?t.tags.split(","):[],period:t.period?t.period:"week"};u.state.filter=a}}),e.watch(()=>u.state.filter,(t,a)=>{const d={...r.query};Object.keys(a).forEach(m=>{d[m]&&delete d[m]});const o=Object.fromEntries(Object.entries(t).filter(([m,s])=>Array.isArray(s)&&s.length>0||typeof s=="string"&&s).map(([m,s])=>[m,Array.isArray(s)?s.join(","):s]));Object.assign(d,o),n.replace({query:d})},{deep:!0}),(t,a)=>(e.openBlock(),e.createElementBlock("section",null,[e.createVNode(u._sfc_main,{category:e.unref(r).params.category,user:g.state.user._id,period:e.unref(r).query.period},null,8,["category","user","period"])]))}},ce=Object.freeze(Object.defineProperty({__proto__:null,default:M},Symbol.toStringTag,{value:"Module"})),ue={class:"w-100 cols-4 t-left flex-nowrap flex"},de={key:0,class:"w-100 br-2px br-solid br-white-transp-10 radius-small pd-small flex-v-center flex-nowrap flex"},me=e.createElementVNode("p",{class:"h4 i-medium mn-r-small"},"👍",-1),pe={class:"t-semi uppercase"},ge=e.createElementVNode("br",null,null,-1),_e={key:1,class:"w-100 br-2px br-solid br-white-transp-10 radius-small pd-small flex-v-center flex-nowrap flex"},fe=e.createElementVNode("p",{class:"h4 i-medium mn-r-small"},"💬",-1),he={class:"t-semi uppercase"},ve=e.createElementVNode("br",null,null,-1),be={key:2,class:"w-100 br-2px br-solid br-white-transp-10 radius-small pd-small flex-v-center flex-nowrap flex"},ye=e.createElementVNode("p",{class:"h4 i-medium mn-r-small"},"👍",-1),we={class:"t-semi uppercase"},ke=e.createElementVNode("br",null,null,-1),xe={__name:"Activity",props:{likes:Number,comments:Number,subscriptions:Number},setup(c){return(r,n)=>(e.openBlock(),e.createElementBlock("section",ue,[c.likes?(e.openBlock(),e.createElementBlock("div",de,[me,e.createElementVNode("span",pe,[e.createTextVNode(e.toDisplayString(c.likes),1),ge,e.createTextVNode("likes")])])):e.createCommentVNode("",!0),c.comments?(e.openBlock(),e.createElementBlock("div",_e,[fe,e.createElementVNode("span",he,[e.createTextVNode(e.toDisplayString(c.comments),1),ve,e.createTextVNode("comments")])])):e.createCommentVNode("",!0),c.subscriptions?(e.openBlock(),e.createElementBlock("div",be,[ye,e.createElementVNode("span",we,[e.createTextVNode(e.toDisplayString(c.subscriptions),1),ke,e.createTextVNode("subscriptions")])])):e.createCommentVNode("",!0)]))}},Be={class:"pd-thin radius-extra flex-nowrap flex"},Ne=["innerHTML"],Ve={__name:"FieldBig",props:{input:String,placeholder:{type:String},action:{type:String,default:"Action"},placeholderTexts:{type:Object,default:()=>({en:["First placeholder","Second placeholder","Third placeholder"],ru:["Первый плейсхолдер","Второй плейсхолдер","Третий плейсхолдер"]})},typingSpeed:{type:Number,default:200},loopTyping:{type:Boolean,default:!1},enableTyping:{type:Boolean,default:!1}},emits:["update:input","action"],setup(c,{emit:r}){const n=c,{t,locale:a}=F.useI18n();let d=e.ref(0),o=e.ref(n.input),m=e.ref(n.placeholder),s=e.ref(n.enableTyping),p=e.ref(null),b=e.ref(""),v=e.ref(!0),k=null;function B(){r("action")}function N(h){r("update:input",h),b.value=h}function l(){d.value=(d.value+1)%n.placeholderTexts[a.value].length}function i(){s.value=!1,clearInterval(p.value),m.value=n.placeholder,b.value||(o.value="")}function _(){!b.value&&n.enableTyping&&(s.value=!0,m.value="",E())}function E(){let h=n.placeholderTexts[a.value][d.value],f=0,y=!1;k=setInterval(()=>{v.value=!v.value},200),p.value=setInterval(()=>{s.value&&(y?(o.value=o.value.slice(0,-1),o.value=h.substring(0,f)+(v.value&&f%2?"|":""),f--):(o.value=h.substring(0,f)+(v.value&&f%2?"|":""),f++),f>h.length&&n.loopTyping&&setTimeout(()=>{y=!0,o.value=h.substring(0,f)},333),f===0&&y&&(y=!1,l(),h=n.placeholderTexts[a.value][d.value]))},n.typingSpeed)}return e.onMounted(()=>{n.enableTyping&&E()}),e.watchEffect(()=>{s.value||(clearInterval(p.value),clearInterval(k))}),(h,f)=>(e.openBlock(),e.createElementBlock("div",Be,[e.createVNode(g.Field,{field:e.unref(o),"onUpdate:field":[f[0]||(f[0]=y=>e.isRef(o)?o.value=y:o=y),N],placeholder:e.unref(m),onInput:l,onFocus:i,onBlur:_,class:"w-100 pd-small p-big"},null,8,["field","placeholder"]),c.action?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:B,class:"w-min hover_bg-white hover-t-black t-black bg-main button",innerHTML:c.action},null,8,Ne)):e.createCommentVNode("",!0)]))}};const Ee={class:"pd-thin"},Ce={class:"o-hidden t-black bg-main pd-big radius-big"},$e=e.createElementVNode("header",{class:"t-center z-index-1 mn-big"},[e.createElementVNode("h2",{class:"mn-l-auto mn-r-auto w-m-40r mn-medium"},"Stay Updated with The Latest in Cannabis."),e.createElementVNode("p",{class:"t-transp p-big"},"Subscribe to our newsletter for news, insights, and more from the Weeder universe.")],-1),Pe={class:"z-index-1 mn-big w-100 flex-nowrap flex"},Te=e.createElementVNode("div",{class:"w-100 h-100 pos-absolute pos-t-50-negative pos-r-0 z-index-0 grid"},[e.createElementVNode("div",{class:"spiral"})],-1),Se={__name:"SubscribeNewsletter",setup(c){let r=e.ref("");return(n,t)=>(e.openBlock(),e.createElementBlock("section",Ee,[e.createElementVNode("div",Ce,[$e,e.createElementVNode("div",Pe,[e.createVNode(Ve,{input:e.unref(r),typingSpeed:75,loopTyping:!1,enableTyping:!1,placeholder:"Please enter your email",action:"Subscribe","onUpdate:input":t[0]||(t[0]=a=>e.isRef(r)?r.value=a:r=a),onAction:t[1]||(t[1]=a=>n.router.push({name:"Product Recommmendation",query:{mood:n.mood}})),class:"mn-l-auto mn-r-auto bg-white t-black w-50"},null,8,["input"])]),Te])]))}};const qe={class:"container container-joinus"},Me={class:"content"},Ie={class:"h0 mn-big"},ze=e.createElementVNode("p",{class:"w-m-33r t-center mn-small p-big"},"Together, we're shaping the future of the globals cannabis community.",-1),De=e.createElementVNode("button",{class:"bg-black t-white button"},"Join Now",-1),Fe={__name:"JoinUs",setup(c){const r=e.ref(120950),n=e.ref(["/assets/images/reviews/01.png","/assets/images/reviews/02.png","/assets/images/reviews/03.png","/assets/images/reviews/04.png","/assets/images/reviews/05.png","/assets/images/reviews/06.png"]),t=()=>{setInterval(()=>{r.value+=Math.floor(Math.random()*5)+1},330)},a={minSize:"6rem",maxSize:"10rem",minDuration:5,maxDuration:15,spawnPoints:[10,90]};e.onMounted(()=>{d(),t()});const d=()=>{n.value.forEach((o,m)=>{let s=document.createElement("img");s.src=o,s.classList.add("floating-image");let p=a.spawnPoints[Math.floor(Math.random()*a.spawnPoints.length)],b=(Math.random()-.5)*2*10;s.style.left=`${p+b}%`,s.style.animationDuration=`${Math.random()*(a.maxDuration-a.minDuration)+a.minDuration}s`,document.querySelector(".container").appendChild(s),s.addEventListener("animationiteration",()=>{const v=a.spawnPoints[Math.floor(Math.random()*a.spawnPoints.length)],k=(Math.random()-.5)*2*10;s.style.left=`${v+k}%`})})};return(o,m)=>(e.openBlock(),e.createElementBlock("div",qe,[e.createElementVNode("div",Me,[e.createElementVNode("span",Ie,e.toDisplayString(r.value.toLocaleString()),1),ze,De])]))}};const Oe=c=>(e.pushScopeId("data-v-18db0d1b"),c=c(),e.popScopeId(),c),Le={class:"community-feed"},je=Oe(()=>e.createElementVNode("h2",{class:"w-m-75r mn-auto pd-t-big pd-b-big t-center"},"Discover the Vibrant Community",-1)),Ue={class:"grid-container"},Ae={__name:"HotPosts",async setup(c){let r,n;const t=e.ref([]),a=async()=>{const o=await u.read({skip:0,limit:7,period:"year"});console.log(o),t.value=o};[r,n]=e.withAsyncContext(()=>a()),await r,n();const d=o=>{switch(o){case 0:return"grid-item-2x2";case 1:return"grid-item-2x1";case 2:return"grid-item-1x1";case 3:case 4:return"grid-item-1x1";case 6:return"grid-item-2x1";default:return""}};return(o,m)=>(e.openBlock(),e.createElementBlock("section",Le,[je,e.createElementVNode("div",Ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(s,p)=>(e.openBlock(),e.createBlock(u._sfc_main$1,{blogpost:s,owner:g.state.user._id,key:p,class:e.normalizeClass(d(p))},null,8,["blogpost","owner","class"]))),128))])]))}},He=P._export_sfc(Ae,[["__scopeId","data-v-18db0d1b"]]),Re=[{path:"community",component:T,meta:{title:{en:"Community",ru:"Коммьюнити"},title_hide:!0},children:[{path:":category?",name:"Blog",meta:{title:{en:"Community",ru:"Коммьюнити"},title_hide:!0},component:()=>Promise.resolve().then(()=>ce)}]},{path:"community/posts/create",name:"Create BlogPost",meta:{title:{en:"Create Post",ru:"Создать Пост"},authorize:[]},component:()=>Promise.resolve().then(()=>C)},{path:"community/posts/:url",name:"BlogPost",meta:{title:{en:"Post",ru:"Пост"}},component:()=>Promise.resolve().then(()=>ie)},{path:"community/posts/:url/edit",name:"Edit BlogPost",meta:{title:{en:"Edit Post",ru:"Редактировать пост"},authorize:[]},component:()=>Promise.resolve().then(()=>C)}];exports.CardBlogpost=u._sfc_main$1;exports.Feed=u._sfc_main;exports.FooterBlogpost=u._sfc_main$2;exports.blogpostsStore=u.blogposts;exports.reactionsStore=u.reactions;exports.Comments=x._sfc_main$2;exports.Activity=xe;exports.Blog=M;exports.BlogPost=q;exports.Community=T;exports.CreateBlogPost=S;exports.HotPosts=He;exports.JoinUs=Fe;exports.SubscribeNewsletter=Se;exports.blogpostsRoutes=Re;
@@ -1,20 +1,20 @@
1
1
  import { resolveComponent as Y, openBlock as i, createElementBlock as p, createElementVNode as o, createVNode as h, normalizeClass as B, unref as c, createCommentVNode as v, withCtx as k, Transition as G, createBlock as I, resolveDynamicComponent as Q, ref as g, onMounted as F, computed as V, createTextVNode as T, createStaticVNode as Z, TransitionGroup as H, Fragment as D, renderList as U, mergeProps as ee, watch as te, toDisplayString as N, watchEffect as se, isRef as W, withAsyncContext as ae, pushScopeId as oe, popScopeId as ne } from "vue";
2
2
  import { useRoute as z, useRouter as A } from "vue-router";
3
- import { S as le, _ as re } from "./Publics-abbe2e0c.mjs";
4
- import { s as M, r as L, c as ie, u as q, a as R, b as ue, d as K, _ as ce } from "./Feed-e9bddb71.mjs";
5
- import { e as ts, f as ss, g as as } from "./Feed-e9bddb71.mjs";
6
- import { s as w, _ as pe, F as de } from "./auth-cfeacd61.mjs";
7
- import { _ as me, a as ge, b as _e, c as he } from "./Image-0e21ae0a.mjs";
8
- import { _ as fe } from "./Popup-e6685f31.mjs";
9
- import { _ as ve, S as be, C as ye } from "./Breadcrumbs.vue_vue_type_style_index_0_lang-97217d38.mjs";
10
- import { a as we } from "./organizations-8ffdf84d.mjs";
3
+ import { S as le, _ as re } from "./Publics-ffc08ad7.mjs";
4
+ import { s as M, r as L, c as ie, u as q, a as R, b as ue, d as K, _ as ce } from "./Feed-b616f102.mjs";
5
+ import { e as ts, f as ss, g as as } from "./Feed-b616f102.mjs";
6
+ import { s as w, _ as pe, F as de } from "./auth-60c81f40.mjs";
7
+ import { _ as me, a as ge, b as _e, c as he } from "./Image-be69af9c.mjs";
8
+ import { _ as fe } from "./Popup-d7dbc670.mjs";
9
+ import { _ as ve, S as be, C as ye } from "./Breadcrumbs.vue_vue_type_style_index_0_lang-9e474158.mjs";
10
+ import { a as we } from "./organizations-52438d24.mjs";
11
11
  import { _ as xe } from "./EmptyState-34d85f10.mjs";
12
12
  import { _ as X } from "./_plugin-vue_export-helper-dad06003.mjs";
13
13
  import { useI18n as $e } from "vue-i18n";
14
14
  import "./globals-96ba60e4.mjs";
15
- import "./CardOrganization-1b0da77c.mjs";
16
- import "./ButtonFollow-6765c266.mjs";
17
- import "./Chips-cc08d85a.mjs";
15
+ import "./CardOrganization-3049931d.mjs";
16
+ import "./ButtonFollow-38d9a720.mjs";
17
+ import "./Chips-03ff0c34.mjs";
18
18
  import "./IconEdit-eacf3856.mjs";
19
19
  import "./vue-draggable-next.esm-bundler-ff6e3f52.mjs";
20
20
  const ke = { class: "min-h-100vh pd-thin" }, Pe = { class: "mn-thin flex-v-center t-left flex-nowrap flex" }, Ce = { class: "flex-v-center flex-nowrap flex t-left" }, Te = /* @__PURE__ */ o("span", { class: "" }, "Topics for ", -1), Se = { class: "w-max bg-grey pd-medium radius-big mn-semi flex-nowrap flex" }, Be = { class: "" }, Ie = {