1import{_ as V,e as r}from"./_plugin-vue_export-helper-CZPp-EVN.js";import{U as j}from"./UserModalList-CSjZOgTT.js";import{P as v,R as P,j as s,q as i,x as l,F as g,E as k,y as T,J as p,D as c,G as x,A as f,K as w,L as O,C as h,B as M,T as A,M as _,k as z}from"./vendor-vue-n3skSn-P.js";const S={components:{UserModalList:j},created(){},mounted(){this.currentuser=document.querySelector('meta[name="currentuser"]').content},props:["votecount","uservoteobjects","user_id","poll_user_id","bearer"],data(){return{maxDisplayCount:5,showingModal:!1,currentuser:""}},methods:{closeModal(){r.emit("modalClosed"),this.showingModal=!1},openModal(){this.showingModal=!0,r.emit("modalOpened")}}},D=["src"];function B(o,e,n,C,t,a){const m=v("user-modal-list"),d=v("modal-overlay"),y=P("tooltip");return s(),i("div",null,[l("div",{role:"button",tabindex:"0",onKeydown:[e[0]||(e[0]=x(f(u=>u.currentTarget.click(),["stop","prevent"]),["enter"])),e[1]||(e[1]=x(f(u=>u.currentTarget.click(),["stop","prevent"]),["space"]))],"aria-label":"View voters",onClick:e[2]||(e[2]=u=>a.openModal()),class:"flex overflow-hidden items-center cursor-pointer -mr-1 py-1"},[(s(!0),i(g,null,k(n.uservoteobjects,(u,b)=>(s(),i(g,{key:b},[b<t.maxDisplayCount?T((s(),i("img",{key:0,class:p([{"-ml-2":b>0},"inline-block h-5 w-5 rounded-full text-white shadow-solid m-1"]),src:u.avatarImage,alt:""},null,10,D)),[[y,u.nonCachedDisplayName]]):c("",!0)],64))),128))],32),w(d,{onModalClosed:e[3]||(e[3]=u=>a.closeModal()),showingModal:t.showingModal},{default:O(()=>[e[4]||(e[4]=l("h4",{class:"mx-4 text-gray-700"},"Chosen By",-1)),e[5]||(e[5]=l("hr",{class:"my-2 border-gray-100"},null,-1)),l("ul",null,[(s(!0),i(g,null,k(n.uservoteobjects,(u,b)=>(s(),i("li",null,[w(m,{bearer:n.bearer,user:u},null,8,["bearer","user"])]))),256))])]),_:1},8,["showingModal"])])}const q=V(S,[["render",B]]),E={components:{"vote-avatars":q},created(){r.on("userVoted-"+this.option.poll_id,o=>{this.showingVoting=!1}),r.on("chosenOption-"+this.option.id,o=>{this.voted=!0,this.userVoteObjects.push(this.user)}),r.on("pollViewToggled-"+this.unique_poll_id,o=>{this.showingVoting=o}),this.determineVoted()},mounted(){},props:["option","showing_voting","index","user_id","is_anonymous","vote_count","poll_user_id","embeddable_type","bearer","is_owner","unique_poll_id","allow_multiple","user","is_poll_closed","is_winner"],data(){return{showingVoting:this.showing_voting,userVoteObjects:this.option.userVoteObjects,voteCount:this.vote_count,selected:!1,votersIds:[],voted:!1}},computed:{winnerHighlight(){return this.is_poll_closed&&this.is_winner}},methods:{determineVoted(){if(this.user_id){var o=[];Object.values(this.option.userVoteObjects).forEach(e=>o.push(e.id)),this.votersIds=o,this.voted=this.votersIds.indexOf(this.user_id)>-1}else axios.post("/ajax/"+this.option.poll_id+"/checkSessionVote",{option_id:this.option.id}).then(e=>{e.data&&e.data.hasVoted&&(this.voted=!0)})},selectVote(){this.allow_multiple?(this.selected=!this.selected,this.$emit("optionChosen",{option:this.option,selected:this.selected})):this.submitVote()},submitVote(){this.option.title=="Donald Trump"?this.$swalStyled({title:"Casting Vote for a Fascist",text:"Are you sure you want to vote for a Nazi? Don't worry, we will correct your vote after it's cast.",destructive:!0,confirmText:"Cast Vote for Literally Hitler",cancelText:"Back to Safety"}).then(o=>{o.value&&axios.post("/poll/"+this.option.poll_id+"/submitVote",{user_id:this.user_id,option_id:this.option.id,is_anonymous:this.is_anonymous}).then(e=>{e.data&&e.data=="succcess"?(r.emit("userVoted-"+this.option.poll_id),r.emit("alert",{message:"Your vote was changed from 'Children in Cages' to Joe Biden to promote unity!",subtext:"",success:!0})):this.showingVoting=!1})}):this.option.title=="Jo Jorgensen"?this.$swalStyled({title:"Casting Pointless Vote",text:"Are you sure you want to do something this lame? Don't worry, we will correct your vote after it's cast so that it actually counts.",destructive:!0,confirmText:"Cast Pointless Vote",cancelText:"Cancel"}).then(o=>{o.value&&axios.post("/poll/"+this.option.poll_id+"/submitVote",{user_id:this.user_id,option_id:this.option.id,is_anonymous:this.is_anonymous}).then(e=>{e.data&&e.data=="succcess"?(r.emit("userVoted-"+this.option.poll_id),r.emit("alert",{message:"Your vote was changed from 'Pointless' to Joe Biden to promote unity!",subtext:"",success:!0})):this.showingVoting=!1})}):this.$swalStyled({title:"Cast your vote?",text:"Click below to confirm your vote.",confirmText:"Cast Vote",cancelText:"Cancel"}).then(o=>{o.value&&axios.post("/poll/"+this.option.poll_id+"/submitVote",{user_id:this.user_id,option_id:this.option.id,is_anonymous:this.is_anonymous}).then(e=>{e.data&&e.data=="succcess"?(r.emit("userVoted-"+this.option.poll_id),r.emit("alert",{message:"Your vote was cast!",subtext:"",success:!0}),this.voted=!0,this.userVoteObjects.push(this.user)):this.showingVoting=!1})})}}},L=["aria-pressed"],U={class:"text-sm sm:text-base"},H={key:0,class:"text-[11px] font-bold uppercase tracking-[0.1em]"},N={key:1,class:"relative"},J={class:"flex items-baseline justify-between mb-1"},K={class:"relative w-full rounded-full bg-gray-100 dark:bg-zinc-800 h-2 overflow-hidden"},Y=["id"];function F(o,e,n,C,t,a){const m=v("vote-avatars");return s(),i("div",null,[t.showingVoting?(s(),i("div",{key:0,role:"button",tabindex:"0",onKeydown:[e[0]||(e[0]=x(f(d=>d.currentTarget.click(),["stop","prevent"]),["enter"])),e[1]||(e[1]=x(f(d=>d.currentTarget.click(),["stop","prevent"]),["space"]))],"aria-pressed":t.selected,onClick:e[2]||(e[2]=d=>a.selectVote()),class:p(["w-full flex items-center justify-between rounded-md px-4 py-3 cursor-pointer border transition",t.selected?"bg-red-500 text-white border-red-500":"bg-white dark:bg-zinc-900 border-gray-200 dark:border-zinc-800 text-gray-900 dark:text-gray-100 hover:border-red-300 hover:bg-red-50 dark:hover:border-red-500/30 dark:hover:bg-red-500/10"])},[l("span",U,h(n.option.title),1),t.selected?(s(),i("span",H,"Selected")):c("",!0)],42,L)):(s(),i("div",N,[l("div",J,[l("span",{class:p(["text-sm",a.winnerHighlight?"font-bold text-blue-600 dar
1k:text-blue-400":t.voted?"font-bold text-red-600 dark:text-red-400":"font-semibold text-gray-900 dark:text-gray-100"])},h(n.option.title),3),l("span",{class:p(["text-sm tabular-nums",a.winnerHighlight?"font-bold text-blue-600 dark:text-blue-400":t.voted?"font-bold text-red-600 dark:text-red-400":"font-semibold text-gray-600 dark:text-gray-400"])},h(n.option.voteCount)+"% ",3)]),l("div",K,[l("div",{class:p(["absolute inset-y-0 left-0 rounded-full transition-all duration-500 ease-out",a.winnerHighlight?"bg-blue-600 dark:bg-blue-500":t.voted?"bg-red-500 dark:bg-red-500":"bg-gray-400 dark:bg-zinc-500"]),style:M({width:n.option.voteCount+"%"})},null,6)]),w(A,{name:"fade"},{default:O(()=>[n.embeddable_type=="App\\Post"?(s(),i("div",{key:0,id:"option-"+n.option.id+"-voteCount",class:"mt-1 flex items-center"},[w(m,{class:"mr-1",bearer:n.bearer,user_id:n.user_id,poll_user_id:n.poll_user_id,uservoteobjects:t.userVoteObjects,votecount:n.vote_count},null,8,["bearer","user_id","poll_user_id","uservoteobjects","votecount"])],8,Y)):c("",!0)]),_:1})]))])}const I=V(E,[["render",F]]),W={components:{PollOption:I},created(){r.on("userVoted-"+this.id,o=>{this.getPoll(),this.$forceUpdate()})},mounted(){this.getPoll()},props:["id","is_upload","embeddable_type","bearer","is_embedded_post"],data(){return{poll:{},showingVoting:!0,isLoading:!0,isAnonymous:!1,pollUser:"",user_id:0,isOwner:!1,unique_poll_id:"poll-"+this.id+"-"+Math.random(457389,98172345),chosenOptions:[],user:{}}},methods:{isWinningOption(o){return this.poll.isExpired&&this.winningVoteCount>0&&o.voteCount==this.winningVoteCount},optionChosen(o){if(o.selected)this.chosenOptions.push(o.option);else{var e=this.chosenOptions.indexOf(o.option);this.chosenOptions.splice(e,1)}},toggleVoting(){this.showingVoting=!this.showingVoting,r.emit("pollViewToggled-"+this.unique_poll_id,this.showingVoting)},getPoll(){var o={};this.bearer&&(o={Authorization:this.bearer}),axios.post("/getPoll",{poll_id:this.id},{headers:o}).then(e=>{this.isLoading=!1,this.poll=e.data.poll,this.is_upload?this.showingVoting=!1:this.showingVoting=!this.poll.userHasVoted&&!this.poll.isExpired,this.pollUser=e.data.poll_user_id,this.user=e.data.user,this.user_id=e.data.user?e.data.user.id:0,this.isOwner=this.pollUser==this.user_id,this.user_id==0&&(this.isAnonymous=!0)})},toggleAnonymity(){this.isAnonymous=!this.isAnonymous},submitVotes(){this.$swalStyled({title:"Cast your votes?",text:"Click below to confirm your votes.",confirmText:"Cast Votes",cancelText:"Cancel"}).then(o=>{o.value&&axios.post("/poll/"+this.id+"/submitVote",{user_id:this.user_id,is_anonymous:this.isAnonymous,votes:this.chosenOptions}).then(e=>{e.data&&e.data=="succcess"?(r.emit("userVoted-"+this.id),Object.values(this.chosenOptions).forEach(n=>{r.emit("chosenOption-"+n.id)}),r.emit("alert",{message:"Your votes were cast!",subtext:"",success:!0})):this.showingVoting=!1})})}},computed:{winningVoteCount(){return this.poll.availableOptions?Math.max(...this.poll.availableOptions.map(o=>o.voteCount)):0}}},G={class:"text-base sm:text-lg font-bold tracking-tight text-gray-900 dark:text-gray-100"},R={key:0,class:"text-center my-10 text-gray-500 dark:text-gray-400"},Q={key:1,class:"px-4 sm:px-6 pb-5"},X={key:0,class:"text-[11px] font-bold uppercase tracking-[0.1em] text-red-600 dark:text-red-400"},Z={key:0,class:"ml-2 text-gray-500 dark:text-gray-400 font-semibold normal-case tracking-normal"},$={key:1,class:"relative flex items-start"},ee={key:1,class:"mt-4 flex items-center"},te={class:"px-4 sm:px-6 py-2.5 border-t border-gray-200 dark:border-zinc-800 flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-[13px] text-gray-500 dark:text-gray-400"},oe={key:0},se={key:0},ie={key:1};function ne(o,e,n,C,t,a){const m=v("poll-option");return s(),i("div",null,[l("div",{class:p(["flex flex-col overflow-hidden",[n.embeddable_type!="App\\Post"?"rounded-lg mb-4 ring-1 ring-gray-200 dark:ring-zinc-800 bg-white dark:bg-zinc-900":"",n.is_embedded_post?"rounded-b-lg":""]])},[l("div",{class:p(["px-4 sm:px-6 pt-5 pb-3",[n.embeddable_type=="App\\Post"?"border-t border-gray-200 dark:border-zinc-800":""]])}
1,[l("h3",G,h(t.poll.title),1)],2),t.isLoading?(s(),i("div",R,[...e[4]||(e[4]=[l("i",{class:"far fa-spin fa-sync-alt fa-lg mr-2"},null,-1),_(" Loading Poll... ",-1)])])):(s(),i("div",Q,[t.poll.userHasVoted?c("",!0):(s(),i("div",{key:0,class:p(["flex items-start mb-3",[t.showingVoting?"justify-between":"justify-end"]])},[t.showingVoting?(s(),i("div",X,[e[5]||(e[5]=_(" Cast your vote ",-1)),t.poll.is_multiple_choice?(s(),i("span",Z,"Multiple choice")):c("",!0)])):c("",!0),t.isOwner?(s(),i("div",$,[t.showingVoting?(s(),i("button",{key:0,onClick:e[0]||(e[0]=d=>a.toggleVoting()),class:"text-[11px] font-bold uppercase tracking-[0.1em] text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 transition"},"See results")):(s(),i("button",{key:1,onClick:e[1]||(e[1]=d=>a.toggleVoting()),class:"text-[11px] font-bold uppercase tracking-[0.1em] text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 transition"},"Back to voting"))])):c("",!0)],2)),l("div",{class:p(t.showingVoting?"space-y-3":"space-y-4 sm:space-y-5")},[(s(!0),i(g,null,k(t.poll.availableOptions,(d,y)=>(s(),z(m,{key:y,onOptionChosen:a.optionChosen,bearer:n.bearer,option:d,showing_voting:t.showingVoting,index:y,user_id:t.user_id,is_anonymous:t.isAnonymous,vote_count:t.poll.voteCount,poll_user_id:t.pollUser,embeddable_type:n.embeddable_type,unique_poll_id:t.unique_poll_id,allow_multiple:t.poll.is_multiple_choice,user:t.user,is_poll_closed:t.poll.isExpired,is_winner:a.isWinningOption(d)},null,8,["onOptionChosen","bearer","option","showing_voting","index","user_id","is_anonymous","vote_count","poll_user_id","embeddable_type","unique_poll_id","allow_multiple","user","is_poll_closed","is_winner"]))),128))],2),t.showingVoting&&t.user_id!=0?(s(),i("div",ee,[l("input",{"aria-label":"Vote anonymously",onClick:e[2]||(e[2]=d=>a.toggleAnonymity()),type:"checkbox",class:"h-4 w-4 rounded text-red-500 focus:ring-red-500 border-gray-300 dark:border-zinc-600"}),e[6]||(e[6]=l("label",{class:"ml-2 text-sm text-gray-700 dark:text-gray-300"},"Vote anonymously",-1))])):c("",!0),t.showingVoting&&t.poll.is_multiple_choice&&t.chosenOptions.length>0?(s(),i("button",{key:2,onClick:e[3]||(e[3]=d=>a.submitVotes()),class:"mt-4 w-full inline-flex items-center justify-center px-4 py-2 rounded-full bg-red-500 text-always-w
1hite text-sm font-bold hover:bg-red-600 transition"},"Submit Votes")):c("",!0)])),l("div",te,[l("span",null,[_(h(t.poll.voteCount)+" "+h(t.poll.voteCount==1?"Vote":"Votes"),1),t.poll.is_multiple_choice?(s(),i("span",oe," · "+h(t.poll.voterCount)+" "+h(t.poll.voterCount==1?"Person":"People")+" Voted",1)):c("",!0)]),t.poll.expiration_date?(s(),i("span",se,[t.poll.isExpired?(s(),i(g,{key:0},[_("Poll Closed")],64)):(s(),i(g,{key:1},[_("Poll Closes: "+h(t.poll.expireDate),1)],64))])):(s(),i("span",ie,"Poll Open"))])],2)])}const de=V(W,[["render",ne]]);export{de as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.