1import{h as e,i as a,q as o,c as t,o as s,d as l,e as n,w as u,D as r,A as i,t as c,C as d,x as m,u as p}from"./index-DXzqL4Kn.js";import{u as k}from"./useSnackbar-EUi1HJal.js";const v={__name:"LikeButton",props:{endpoint:String,modelValue:Boolean,likeCount:Number},emits:["update:modelValue","update:likeCount"],setup(v,{emit:h}){const w=m(),C=p(),{error:f}=k(),g=e((()=>C.params.locale)),V=v,b=h,j=a(!1),x=a(V.likeCount);o((()=>V.likeCount),(e=>{j.value||(x.value=e)}));const y=async()=>{j.value=!0;try{const e=await fetch(V.endpoint,{method:"POST",headers:{"Content-Type":"application/json","Lang-code":g.value,Secure:"web"}});if(202===e.status||200===e.status)return b("update:modelValue",!0),b("update:likeCount",x.value+1),void(x.value+=1);const a=await e.json().catch((()=>({})));throw{status:e.status,error:(null==a?void 0:a.error)||"Unknown error"}}catch(e){console.error(e),f(e.error||e.message||"Unknown error"),403===e.status&&await w.push(`/${g.value}/login`)}finally{j.value=!1}};return(e,a)=>(s(),t("div",{class:"item like d-flex ga-1 align-center",onClick:d(y,["stop"])},[l(i,{size:"24",class:r({clickable:!v.modelValue}),color:v.modelValue?"#F8B400":"#1F2024"},{default:u((()=>a[0]||(a[0]=[n(" mdi-thumb-up-outline ")]))),_:1},8,["class","color"]),n(" "+c(x.value),1)]))}};export{v as _};
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.