1import{d as e,a as t,u as a}from"./Cm2J8wJT.js";import{ah as s,ak as i,am as l,J as n,L as o,U as r,V as g,M as d,Q as c,a5 as m,T as u,$ as h,O as _}from"./Cw52Jb_b.js";import"./oPzPbeIq.js";import"./Dv5-W7ly.js";const p=e({name:"SingleImage",setup:()=>({store:t()}),props:["image","galleryId","gId","galleryTitle","imageIndex","hideDetails","imageUrl","unauthorizedLikes","inArticle","isPhotostory","maxImage","handleGalleryForced","noSsr"],data:()=>({votesLoading:!1,fullscreen:!1,teleport:!0,pageOnly:!1,forcedFullscreen:!1,recentlyVoted:!1}),methods:{toggleFullScreen(){const e=this;if(e.image)if(e.$fullscreen.support)e.$fullscreen.toggle(e.$refs[`imageContainer_${e.image.id}`],{teleport:this.teleport,pageonly:this.pageOnly,callback:e=>{this.fullscreen=e}});else{const e=!this.forcedFullscreen;this.handleGalleryForced&&this.handleGalleryForced(e),this.forcedFullscreen=e}},fullScreenChange(e){this.fullscreen=e},async handleVote(e){if(!this.canVote)return!1;try{if(!this.userId&&!this.unauthorizedLikes)return void(window.location=`/login?redirect=/lista-galerii/${this.galleryId}`);{const t={vote:e,gallery_id:this.gId,user_id:this.userId};if(this.unauthorizedLikes&&!this.userId||this.userId){t.user_id=this.userId||-1;a(`gallery_voted_${this.galleryId}_${this.image.id}_${1===e?"up":"down"}`).value="1"}if(this.votesLoading=e,await $fetch(`/api/galleries/${this.image.id}`,{method:"POST",body:t}),this.image.hasOwnProperty("votes")||(this.image.votes={up:[],down:[]}),!this.unauthorizedLikes||this.userId){const e=this.image.votes[1===t.vote?"down":"up"].find((e=>e.user_id===this.userId));e&&this.image.votes[1===t.vote?"down":"up"].splice(this.image.votes[1===t.vote?"down":"up"].indexOf(e),1)}this.image.votes[1===t.vote?"up":"down"].push(t),this.recentlyVoted=1===t.vote?1:-1}}catch(t){}this.votesLoading=!1},handleModalActive(){const e=new CustomEvent("imageShareModalOpen",{detail:{url:this.imageUrl,title:this.image.name||this.galleryTitle,description:this.image.description||"",media:this.getImageUrl(this.image.url)}});document.dispatchEvent(e)}},computed:{userId(){return!!this.store.user&&this.store.user.id},votedUp(){if(this.userId){const e=this.image.votes;return!!(e&&e.up&&e.up.length>0)&&e.up.find((e=>e.user_id===this.userId))}return a(`gallery_voted_${this.galleryId}_${this.image.id}_up`).value||1===this.recentlyVoted},votedDown(){if(this.userId){const e=this.image.votes;return!!(e&&e.down&&e.down.length>0)&&e.down.find((e=>e.user_id===this.userId))}return a(`gallery_voted_${this.galleryId}_${this.image.id}_down`).value||-1===this.recentlyVoted},canVote(){return!this.votedDown&&!this.votedUp&&!this.recentlyVoted},settings(){return this.store.settings},adProvider(){return this.settings&&this.settings.programmatic_settings&&this.settings.programmatic_settings.provider?this.settings.programmatic_settings.provider:"ZPR"}}},"$BEADZyP7k0"),y={key:0,class:"gallery__image-uptitle"},v={class:"gallery__image-container"},f={key:0,class:"photostory-item__count"},I=["src","alt","data-not-lazy"],k=["lazy-src","alt","data-not-lazy"],b={key:1,class:"gallery__image-author"},w={key:0,class:"gallery__image-title"},L={class:"gallery__image-social"},$={class:"image-button__icon"},F={key:0,class:"spinner-border",role:"status"},S={class:"image-button__value"},z={class:"image-button__icon"},U={key:0,class:"spinner-border",role:"status"},V={class:"image-button__value"},x={key:0,class:"gallery__image-share"},M={class:c(["shareModal"])},C={class:"shareModal__button-icon"},D={key:1,class:"gallery__image-desc gallery__mobile-wrap"},A=["innerHTML"];const T=s(p,[["render",function(e,t,a,s,p,T){const O=i("font-awesome-icon"),P=l("lazysource");return e.image?(n(),o("div",{key:0,class:c(["gallery__image",e.inArticle?"gallery__image--inarticle":""])},[e.inArticle?(n(),o("h2",y,r(e.image.name),1)):g("",!0),d("div",v,[e.isPhotostory?(n(),o("span",f,r(e.imageIndex)+" z "+r(e.maxImage),1)):g("",!0),d("div",{class:c(["gallery__image-content","fullscreen-wrapper",!!e.forcedFullscreen&&"fullscreen-wrapper__forced"]),ref:`imageContainer_${e.image.id}`},[e.noSsr?(n(),o("img",{key:0,src:e.getImageUrl(e.image.url),alt:e.imageIndex&&1===e.imageIndex?e.galleryTitle:e.image.name,"data-not-lazy":e.noSsr},null,8,I)):m((n(),o("img",{key:1,"lazy-src":e.getImageUrl(e.image.url),alt:e.imageIndex&&1===e.imageIndex?e.galleryTitle:e.image.name,"data-not-lazy":e.noSsr},null,8,k)),[[P]]),d("span",{class:"gallery__image-close",onClick:t[0]||(t[0]=(...t)=>e.toggleFullScreen&&e.toggleFullScreen(...t))})],2),e.image.author&&""!==e.image.author?(n(),o("div",b,[e.inArticle||e.hideDetails||!e.image.name||""===e.image.name?g("",!0):(n(),o("h2",w,r(e.image.name),1)),u(" Fot. "+r(e.image.author),1)])):g("",!0),d("button",{class:"gallery__image-fullscreen",onClick:t[1]||(t[1]=(...t)=>e.toggleFullScreen&&e.toggleFullScreen(...t))},[h(O,{icon:["fas","expand"]})])]),d("div",L,[d("div",{class:c(["gallery__image-likes",e.canVote?"":"gallery__image-likes--voted"])},[d("span",{class:c(["gallery__image-button","image-button","image-button--success",e.votesLoading?"image-button--loading":"",e.votedUp?"image-button--active":""]),onClick:t[2]||(t[2]=t=>!e.votedUp&&!e.votesLoading&&e.handleVote(1))},[d("span",$,[e.votesLoading&&1==e.votesLoading?(n(),o("span",F,t[5]||(t[5]=[d("span",{class:"sr-only"},"Loading...",-1)]))):(n(),_(O,{key:1,icon:["far","thumbs-up"]}))]),d("span",S,r(e.image.votes?e.image.votes.up.length:0),1)],2),d("span",{class:c(["gallery__image-button","image-button","image-buttonvar(--bs-danger",e.votesLoading?"image-button--loading":"",e.votedDown?"image-button--active":""]),onClick:t[3]||(t[3]=t=>!e.votedDown&&!e.votesLoading&&e.handleVote(-1))},[d("span",z,[e.votesLoading&&-1==e.votesLoading?(n(),o("span",U,t[6]||(t[6]=[d("span",{class:"sr-only"},"Loading...",-1)]))):(n(),_(O,{key:1,icon:["far","thumbs-down"]}))]),d("span",V,r(e.image.votes?e.image.votes.down.length:0),1)],2)],2),e.imageUrl?(n(),o("div",x,[d("div",M,[d("div",{class:"shareModal__trigger shareModal__button",onClick:t[4]||(t[4]=(...t)=>e.handleModalActive&&e.handleModalActive(...t))},[t[7]||(t[7]=d("span",null,"UdostÄpnij",-1)),d("span",C,[h(O,{icon:["fa","share"]})])])])])):g("",!0)]),!e.hideDetails&&e.image.description&&e.image.description.length>5?(n(),o("div",D,[d("div",{class:"imgDesc",innerHTML:e.image.description},null,8,A)])):g("",!0)],2)):g("",!0)}]]);export{T 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.