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T,CACEZ,EAAIQ,GAAG,GAAG,SAAUjC,GAClB,MAAO,CAAC0B,EAAG,IAAK,CAAEE,YAAa,eAChC,KAEH,KAGJH,EAAIS,GAAG,KACPR,EAAG,OAAQ,CAAEE,YAAa,WAAa,CACrCH,EAAIS,GACF,oBACET,EAAIa,GAAGb,EAAItB,eACX,QACAsB,EAAIa,GAAGb,EAAI/C,cACX,sBAOd+C,EAAIc,IACT,EAEDf,EAAOgB,eAAgB,E,IC3DmK,EC0B1L,CACEC,OAAQ,C,QAACA,GACTC,SAAU,CACRhE,aADJ,WAGM,OAAOuC,KAAKC,OAAO7C,MAAMsE,iBAAiBjE,YAC5C,EACAI,QALJ,WAMM,OAAOmC,KAAKC,OAAO7C,MAAMsE,iBAAiB7D,OAC5C,EACAqB,cARJ,WASM,OAAOc,KAAKC,OAAO7C,MAAMsE,iBAAiB/D,SAC5C,GAEFgE,QAAS,CAAC,GCtBZ,GAXgB,E,QAAA,GACd,EACApB,EHiDoB,IG/CpB,EACA,KACA,KACA,MAI8B,O","sources":["webpack://SpotlightReviews/./resources/js/src/app/store/SpotlightReviewsStore.js","webpack://SpotlightReviews/./resources/js/src/app/mixins/loadSpotlightReviews.js","webpack://SpotlightReviews/./resources/js/src/app/articlerating.vue","webpack://SpotlightReviews/./resources/js/src/app/articlerating.vue?09da","webpack://SpotlightReviews/resources/js/src/app/articlerating.vue","webpack://SpotlightReviews/./resources/js/src/app/articlerating.vue?6119"],"sourcesContent":["\nconst state = () => ({\n reviews: [],\n stars: { 5: 0, 4: 0, 3: 0, 2: 0, 1: 0 },\n selectedReview: {},\n selectedParent: {},\n avgRating:0,\n totalReviews:0,\n userIds:[],\n totalForCurrentRequest:0\n});\n\nconst mutations = {\n setuserIds(state, userIds) {\n state.userIds = userIds;\n },\n settotalForCurrentRequest(state, totalForCurrentRequest) {\n state.totalForCurrentRequest = totalForCurrentRequest;\n },\n settotalReviews(state, totalReviews) {\n state.totalReviews = totalReviews;\n },\n setavgRating(state, avgRating) {\n state.avgRating = avgRating;\n },\n setReviews(state, reviews) {\n state.reviews = reviews;\n },\n setStars(state, stars) {\n state.stars = stars;\n },\n setSelectedReview(state, review) {\n state.selectedReview = review;\n },\n addReview(state, review) {\n state.stars[review.rating]++;\n state.reviews.unshift(review);\n state.totalReviews++\n state.totalForCurrentRequest++\n state.userIds.push(review.userId)\n },\n reviewRating(state,rating)\n {\n state.reviewRating = rating;\n },\n addToParent(state,review)\n {\n state.selectedParent.replies.unshift(review)\n },\n setParent(state,review)\n {\n state.selectedParent = review;\n },\n recalcRating(state)\n {\n let totalScore = 0;\n let totalReviews = 0;\n\n // Iterate over each key in the stars object\n for (let star in state.stars) {\n const rating = parseInt(star); // Convert the star key to an integer\n const count = state.stars[star]; // Get the number of reviews for this star rating\n\n totalScore += rating * count; // Add to the total score (rating * number of reviews)\n totalReviews += count; // Add to the total number of reviews\n }\n\n // Calculate the average rating\n const averageRating = totalScore / totalReviews;\n\n // Handle the case where there are no reviews to avoid division by zero\n state.avgRating = totalReviews === 0 ? 0 : averageRating.toFixed(2);\n },\n deleteReview(state, reviewToDelete) {\n state.reviews = state.reviews.filter(review => review.id != reviewToDelete.id);\n state.stars[reviewToDelete.rating]--;\n state.totalReviews--\n state.totalForCurrentRequest--\n\n const index = state.userIds.indexOf(reviewToDelete.userId); // Find the index of the id in the array\n if (index !== -1) { // If the id is found in the array\n state.userIds.splice(index, 1); // Remove the id from the array\n }\n },\n deleteFromParentReview(state, reviewId) {\n\n state.selectedParent.replies = state.selectedParent.replies.filter(review => review.id != reviewId);\n },\n};\n\nconst actions = {\n\n};\n\nconst getters = {\n\n};\n\nexport default({\n state,\n mutations,\n actions,\n getters\n});\n","import SpotlightReviewsStore from '../store/SpotlightReviewsStore'\n\nexport default {\n created () {\n if (!this.$store.hasModule('SpotlightReviews') && !App.isSSR) {\n this.$store.registerModule('SpotlightReviews', SpotlightReviewsStore)\n }\n }\n}","var render = function render() {\n var _vm = this,\n _c = _vm._self._c\n return _vm.totalReviews > 0\n ? _c(\"div\", { staticClass: \"SpotlightReview-article-rating\" }, [\n _c(\"div\", { staticClass: \"article-rating-wrapper\" }, [\n _c(\n \"a\",\n { staticClass: \"d-flex\", attrs: { href: \"#SpotlightReviews\" } },\n [\n _c(\"div\", [\n _c(\n \"div\",\n {\n staticClass: \"d-flex ratingStars\",\n style: { width: (_vm.averageRating / 5) * 100 + \"%\" },\n },\n [\n _vm._l(5, function (star) {\n return [_c(\"i\", { staticClass: \"fa fa-star\" })]\n }),\n ],\n 2\n ),\n _vm._v(\" \"),\n _c(\n \"div\",\n {\n staticClass: \"greyStars d-flex\",\n staticStyle: {\n position: \"relative!important\",\n top: \"-20px!important\",\n },\n },\n [\n _vm._l(5, function (star) {\n return [_c(\"i\", { staticClass: \"fa fa-star\" })]\n }),\n ],\n 2\n ),\n ]),\n _vm._v(\" \"),\n _c(\"span\", { staticClass: \"h4 ml-2\" }, [\n _vm._v(\n \"\\n - \" +\n _vm._s(_vm.averageRating) +\n \" ⌀ ( \" +\n _vm._s(_vm.totalReviews) +\n \" )\\n \"\n ),\n ]),\n ]\n ),\n ]),\n ])\n : _vm._e()\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }","import mod from \"-!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./articlerating.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./articlerating.vue?vue&type=script&lang=js&\"","\n \n\n\n\n","import { render, staticRenderFns } from \"./articlerating.vue?vue&type=template&id=1529e645&\"\nimport script from \"./articlerating.vue?vue&type=script&lang=js&\"\nexport * from \"./articlerating.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports"],"names":["mutations","setuserIds","state","userIds","settotalForCurrentRequest","totalForCurrentRequest","settotalReviews","totalReviews","setavgRating","avgRating","setReviews","reviews","setStars","stars","setSelectedReview","review","selectedReview","addReview","rating","unshift","push","userId","reviewRating","addToParent","selectedParent","replies","setParent","recalcRating","totalScore","star","parseInt","count","averageRating","toFixed","deleteReview","reviewToDelete","filter","id","index","indexOf","splice","deleteFromParentReview","reviewId","actions","getters","created","this","$store","hasModule","App","isSSR","registerModule","SpotlightReviewsStore","render","_vm","_c","_self","staticClass","attrs","href","style","width","_l","_v","staticStyle","position","top","_s","_e","_withStripped","mixins","computed","SpotlightReviews","methods"],"sourceRoot":""}